python模块之ConfigParser:解析配置文件模块
来源:互联网 发布:淘宝怎么设置促销价格 编辑:程序博客网 时间:2024/05/18 04:54
python模块之ConfigParser:解析配置文件模块
ConfigParser是一个简单易用的python解析配置文件的模块,可以从配置文件中解析出各section,各种类型的参数。
配置文件
# cat sample.conf
[numbers]pi = 3.141592653[messages]greeting = Welcome to the area calculation program!question = Please enter the radius:result_message = The area is
解析代码
# cat parseconfig.py
#!/usr/bin/env pythonimport ConfigParserCONFIGFILE = 'sample.conf'config = ConfigParser.ConfigParser()#Read config fileconfig.read(CONFIGFILE)print config.get('messages', 'greeting')radius = input(config.get('messages', 'question') + ' ')print config.get('messages', 'result_message'),print config.getfloat('numbers', 'pi') * radius**2
- python模块之ConfigParser:解析配置文件模块
- Python之配置文件解析模块ConfigParser简介
- Python之配置文件模块 ConfigParser
- python模块之ConfigParser: 用python解析配置文件
- python模块之ConfigParser: 用python解析配置文件
- 解析配置文件ConfigParser模块
- PYTHON 配置文件模块 ConfigParser
- Python 配置文件 ConfigParser 模块
- ConfigParser模块学习: 用python解析配置文件
- Python模块:配置文件解析器configparser
- Python 解析配置文件 (ConfigParser)模块
- 【Python】配置文件解析模块ConfigParser使用实例
- 嵌入式 python之ConfigParser配置解析模块
- Python 解析配置模块之ConfigParser详解
- Python 解析配置模块之ConfigParser详解
- Python 解析配置模块之ConfigParser详解
- Python 解析配置模块之ConfigParser详解
- Python 解析配置模块之ConfigParser详解
- Linux环境下安装php网站(服务器,远程)
- DB2索引类型介绍
- 【Android多屏适配】动态改变Listview item高度
- 自定义View的onMeasure方法理解
- 用switch-case一个OnClickListener触发多个button的事件
- python模块之ConfigParser:解析配置文件模块
- Android的属性系统
- 【MM应用引擎示例代码】jQuery仿QQ窗口抖动特效
- UISearchBar使用
- Visual Studio 目标框架造成 命名空间“Microsoft”中不存在类型或命名空间名称“Crm”。是否缺少程序集引用中错误的处理
- 完成端口
- stm32+ucos+ucgui 中edit框读取AD值以十进制显示
- hive 建表大全
- URAL 1055 - Combinations(快速筛素因子个数)