python中configParser模块的基础用法
来源:互联网 发布:网络男女对唱歌曲大全 编辑:程序博客网 时间:2024/06/05 09:54
#配置文件模块import configparserconfig = configparser.ConfigParser()config['default'] = { 'ServerAliveInterval': '45', 'Conpression': 'yes', 'ConpressionLevel': '9'}config['bitbucket.org'] = { 'User': 'hg'}config['topscret.server.com'] = {}topscret = config['topscret.server.com']topscret['Host Port'] = '5001'topscret['forwardX11'] = 'no'config['default']['forwarX11'] = 'yes'with open('example.ini', 'w') as configfile: config.write(configfile)================================================================================================#配置文件模块import configparserconfig = configparser.ConfigParser()config.read('example.ini')print(config.sections()) #['default', 'bitbucket.org', 'topscret.server.com']print(config['default']['Conpression'])for key in config['default']: print(key)================================================================================================#配置文件模块import configparserconfig = configparser.ConfigParser()config.read('example.ini') #***先读取print(config.has_section('default'))config.set('bitbucket.org', 'user', 'leo')config.remove_option('bitbucket.org', 'user')config.write(open('example.ini', 'w')) #***重写
阅读全文
0 0
- python中configParser模块的基础用法
- Python中ConfigParser模块的使用
- python 的 ConfigParser 模块
- python的ConfigParser模块
- python中ConfigParser模块使用
- Python中ConfigParser模块应用
- Python3 中 configparser 模块解析配置的用法详解
- python中json模块的基础用法
- python 中configparser的使用
- PYTHON 配置文件模块 ConfigParser
- Python模块之: ConfigParser
- python 之ConfigParser模块
- Python ConfigParser模块
- Python Configparser模块
- python ConfigParser 模块学习
- Python-ConfigParser模块简介
- python模块之ConfigParser
- Python ConfigParser模块教程
- 练习1.教务系统设计
- 树莓派
- 2016-CVPR-YOLO论文详解
- 训练集和测试集的划分
- button与验证控件的矛盾
- python中configParser模块的基础用法
- 隐藏的love
- 输入0~N的所有数
- 使用函数求奇数和
- 318. Maximum Product of Word Lengths
- clob字段升级到Oracle DB 12.2的问题
- 浏览器的兼容性问题
- C语言笔记(关键字)
- React 条件渲染 if