configparser读
#-*-coding:utf-8-*-
__author__ = "logan.xu"
import configparser
conf = configparser.ConfigParser()
conf.read("example.ini")
print(conf.defaults())
print(conf['bitbucket.org']['user'])
#改写
sec = conf.remove_section('bitbucket.org')
conf.write(open('example.ini',"w"))
#conf.write(open('example.cfg',"w"))
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
OrderedDict([('serveraliveinterval', '45'), ('compression', 'yes'), ('compressionlevel', '9'), ('forwardx11', 'yes')])
hg