import json,time,os,sys
import configparser


if __name__ == "__main__":
    #读取 cfg.ini 
    cfg=configparser.ConfigParser()
    cfg.read('cfg.ini')

    print(cfg['app']['appname'])
    print(cfg.get('app','appname'))
    #读取所用[]
    print(cfg.sections() )

    #写入
    self.cfg.set('client','ver',lst['data']['ver'])
    self.cfg.set('client','scope',lst['data']['scope'])
    self.cfg.set('server','gate_url',lst['data']['gate_url'])
    #保存文件
    with open('cfg.ini','w+') as f:
        self.cfg.write(f)