python读取配置文件

import configparser

cf = configparser.ConfigParser()

cf.read("config.ini", encoding='UTF-8')

username=cf.get("user","username") 

auto=cf.get("autologin","auto")

 

config.ini

[user]

username=abcd

[autologin]

auto=1

原文地址:https://www.cnblogs.com/chenglee/p/14854679.html