python如何解析config文件
2011-01-07 16:12
686 查看
For example:
import ConfigParser
config = ConfigParser.ConfigParser() config.read('example.cfg') # Set the third, optional argument of get to 1 if you wish to use raw mode. print config.get('Section1', 'foo', 0) # -> "Python is fun!" print config.get('Section1', 'foo', 1) # -> "%(bar)s is %(baz)s!" # The optional fourth argument is a dict with members that will take # precedence in interpolation. print config.get('Section1', 'foo', 0, {'bar': 'Documentation', 'baz': 'evil'})
相关文章推荐
- 【Python】配置文件解析模块ConfigParser使用实例
- Python解析配置文件模块:ConfigPhaser
- Python 解析ini文件 By ConfigParser
- 在python中实现自定义配置文件解析及应用技巧[yaml and ConfigParser] 推荐
- config 文件解析程序(python版)
- python模块之ConfigParser: 用python解析配置文件
- python ConfigParser – 配置文件解析
- Python配置文件解析模块ConfigParser使用实例
- Python用ConfigParser解析INI配置文件
- ConfigParser模块学习: 用python解析配置文件
- python爬虫 如何解析json文件 json文件的解析提取和jsonpath的应用
- python模块之ConfigParser:解析配置文件模块
- python ConfigParser – 配置文件解析(转载)
- 如何用python解析mysqldump文件
- python中用Configparser模块解析配置文件
- [zz]python模块之ConfigParser: 用python解析配置文件
- python ConfigParser模块 配置文件解析
- python模块之ConfigParser: 用python解析配置文件[zt]
- python模块之ConfigParser: 用python解析配置文件
- python 中对配置文件的解析 ConfigParser & ConfigObj