cf = configparser.ConfigParser()
cf.read('文件名')
## 读取
cf.sections()
cf.options(section)
cf.items(option)
cf.get(section, option)
cf.getint(section, option)
## 写入
cf.add_section('名字')
cf.set('section', 'option', 'value')
with open('文件名', ‘w+’) as f:
cf.write(f)