首页 > 编程语言 > 详细

python3 ini文件读写

时间:2019-11-14 20:20:02      阅读:90      评论:0      收藏:0      [点我收藏+]

 

import  configparser
  
config = configparser.ConfigParser()
file = config.ini
config.read(file)
config.add_section(login)
config.set(login,username,1111)
config.set(login,password,2222)
with open(file,w) as configfile:
    config.write(configfile)


config = configparser.ConfigParser()
file = config.ini
config.read(file)
username = config.get(login,username)
password = config.get(login,password)
print(username,password)

 

python3 ini文件读写

原文:https://www.cnblogs.com/sea-stream/p/11861039.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!