首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Python > 处理配置文件的Python模块。以方便使用,灵活,并保持注释和布局完整。

处理配置文件的Python模块。以方便使用,灵活,并保持注释和布局完整。

资 源 简 介

The confparse python module can process simple properties files but also files with sections. It gives convenient access to the values, or gives features like variable evaluation or default values. Configuration files can not only be read but also updated with one-liners, while keeping layout and comments intact. Options can be added, deleted, and uncommented. Confparse is extensible and can map new format without too much work. I am circulating this alpha version to developers in the field in hopes that they can help removing the most egregious errors before too many other people see it (*). Read a value from a file Let"s say your file is one of the numerous "key=value" file such as a java properties file , a network interface file, etc. from confparse import propertieshttp_port = properties( "/etc/my-app/config.conf" ).get( "HttpPort" )sip_port = properties( "/opt/sipserver/conf.txt" ).get( "SipPort", 5060 ) When you g
VIP VIP
0.183941s