标签:sha value you bsp int res shang pass option
#python configparser读写配置文件 import configparser config = configparser.ConfigParser() c=config.read("config.ini") print(c)#[‘config.ini‘] #获取section print(config.sections())#[‘info‘, ‘address‘] #获取section下的所有信息 print(config.items(section="info"))#[(‘password‘, ‘whoareyou‘), (‘username‘, ‘Tom‘)] #根据section获取option print(config.options("info"))#[‘password‘, ‘username‘] print(config.options("address"))#[‘province‘, ‘country‘] #根据section,option获取value print(config.get("info","username"))#Tom print(config.get("address","province"))#Shanxi #写入配置文件 config.set("info","password","iamfine") config.set("address","province","shanghai") with open("config.ini","w+") as file: config.write(file) print(config.items("info"))#[(‘password‘, ‘whoareyou‘), (‘username‘, ‘Tom‘)]
config.ini
[info] password =123465 username = Tom [address] province = Shanxi country = China
标签:sha value you bsp int res shang pass option
原文地址:https://www.cnblogs.com/pfeiliu/p/12483924.html