configparser生成模块

import configparser

config = configparser.ConfigParser()
config['DEFAULT'] = {
'ServerAliveInterval': '45',
'Compression': 'yes',
'CompressionLevel': '9'
}
config['bitbucket.org'] = {}
config['bitbucket.org']['User'] = 'hg'
config['topsecret.server.com'] = {}
config['topsecret.server.com']['Port'] = '50022'
config['topsecret.server.com']['ForwardX11'] = 'no'
config['DEFAULT']['ForwardX11'] = 'yes'

with open('example1.ini', 'w') as configfile:
.......config.write(configfile)

猜你喜欢

转载自blog.51cto.com/3906249/2296443
今日推荐