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)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章