python ConfigParser使用
来源:互联网 发布:强制视频软件多少钱 编辑:程序博客网 时间:2024/05/18 03:49
ConfigParser配置文件传递参数
使用方法:
- 创建一个配置文件,参数格式如下:
[init]unit_time = 60max_time = 60memcache_threshold = 1ssd_threshold = 2mem_log_file_path = /usr/local/monitor/hotpoint/mem.logssd_log_file_path = /usr/local/monitor/hotpoint/ssd.logreal_time_log_file_path = /var/log/nginx/nginx_hot_access.log
中括号是一个域,域下面是参数 import ConfigParserconf = ConfigParser.ConfigParser()conf.read("/usr/local/monitor/hotpoint/hotUrl.conf")print "unit_time: %s" % (conf.get("init", "unit_time"))print "max_time: %s" % (conf.get("init", "max_time"))print "memcache_threshold: %s" % (conf.get("init", "memcache_threshold"))print "ssd_threshold: %s" % (conf.get("init", "ssd_threshold"))print "mem_log_file_path: %s" % (conf.get("init", "mem_log_file_path"))print "ssd_log_file_path: %s" % (conf.get("init", "ssd_log_file_path"))print "real_time_log_file_path: %s" % (conf.get("init", "real_time_log_file_path"))
具体可以参照http://blog.chinaunix.net/uid-10597892-id-3535639.html
0 0
- Python ConfigParser的使用
- Python ConfigParser的使用
- Python ConfigParser的使用
- python ConfigParser使用
- Python ConfigParser的使用
- Python ConfigParser的使用
- Python ConfigParser的使用
- Python ConfigParser使用
- python 中configparser的使用
- python中ConfigParser模块使用
- Python文件配置configParser使用
- Python ConfigParser
- python ConfigParser
- python -- ConfigParser
- python-ConfigParser
- Python ConfigParser
- python ConfigParser
- python configparser
- 去除html中标签方法
- 1元抢一加手机刘作虎:根绝内部职工与黄牛
- Spiral Matrix II
- 解决Struts2 json-plugin Date或Timestamp等日期格式带T的问题
- jquery 幻灯片轮播图
- python ConfigParser使用
- Q_SLOTS/Q_SIGNALS与namespace
- Eclipse拥有像VS2010一样的代码提示功能的设置方法
- 微信网页分享代码
- UNIX Load Average Part 1: How It Works
- 数据处理
- windows下,绿色版 tomcat6.0 安装法
- 读《狼牙山五壮士》有感
- 浅谈公安350兆集群通信网建设