Pythonconfigparser模块配置文件过程解析-创新互联
ConfigParser模块在Python3修改为configparser,这个模块定义了一个ConfigeParser类,该类的作用是让配置文件生效。配置文件的格式和window的ini文件相同

编辑配置文件: .ini
模板:内容自定义
一、 编辑配置文件
import configparser
config = configparser.ConfigParser()
config['DEFAULT'] = {
'ServerAliveInterval':'45',
'Compression':'yes',
'CompressionLevel':'9',
'ForwardX11':'yes'
}
config['bitbucker.org'] = {
'Host Port':'50022',
'ForwardX11':'no'
}
config['path'] = {
'Base_Path':'D:\python\pychrom\路飞学城\day8',
'student_path':'D:\python\pychrom\路飞学城\day8\configparser模块.py'
}
with open('example.ini','w',encoding='utf-8') as configfile:
config.write(configfile)另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享文章:Pythonconfigparser模块配置文件过程解析-创新互联
网站链接:http://www.jxjierui.cn/article/dgihdj.html


咨询
建站咨询
