返回顶部

配置文件模块


# import configparser
#
# config = configparser.ConfigParser()
#
#
# # config["DEFAULT"] = {'ServerAliveInterval': '45',
# #                      'Compression': 'yes',
# #                      'CompressionLevel': '9'}
# #
# # config['bitbucket.org'] = {'User':'hg'}
# #
# # config['topsecret.server.com'] = {}
# # topsecret = config['topsecret.server.com']
# # topsecret['Host Port'] = '50022'  # mutates the parser
# # topsecret['ForwardX11'] = 'no'  # same here
# # config['DEFAULT']['ForwardX11'] = 'yes'
# #
# #
# #
# # with open('example.ini', 'w') as configfile:
# #     config.write(configfile)
#
# # print(config.sections())
#
# config.read('example.ini')
# # print(config.sections())
# # print(config.defaults())
# #
# # print(config['bitbucket.org']['User'])
#
# # for key in config['bitbucket.org']:
# #     print(key)
#
# config.remove_section('topsecret.server.com')
# print(config.has_section('topsecret.server.com'))
#
# config.remove_option('bitbucket.org','user')
#
# # config.set('bitbucket.org','user','alex')
#
#
# config.write(open('example.ini', "w"))

 

posted @ 2016-09-11 21:04  Will_D_Zhang  阅读(181)  评论(0编辑  收藏  举报