一、讀取configparser 配置文件報錯 :spa
提示:ip
ConfigParser.MissingSectionHeaderError when parsing rsyncd config file with global optionsutf-8
解決方法:get
cfg = configparser.ConfigParser()
with open(file,'r') as fp:
cfg.read_file(itertools.chain(['[global]'], fp), source=file)
# config.read(file,encoding='utf-8')
gw_sip = cfg.get('test_sip_endpoint','gw_sip')io