python configure
2013-12-21 19:25
218 查看
configuration文件命名为*.conf
1.import ConfigParser
2.初始化 cf=ConfigParser.ConfigParser()
3.获取section集合 secs=cf.sections()
4.通过每个sec,获取其options & items
5.进行处理import ConfigParser def read2header(file): headermap={} headerconfig=ConfigParser.ConfigParser() #read config headerconfig.read(file) #return secions secs=headerconfig.sections() #print "sections: ",secs for sec in secs: headermap[sec]={} items = headerconfig.items(sec) #print 'items:', items for item in items: headermap[sec][item[0]]=item[1] return headermap
相关文章推荐
- gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable
- python代码制作configure文件
- How to Configure Eclipse for Python
- configure: error: Can not link to python
- centOS升级python2至python3过程中遇到configure: error: no acceptable C compiler found in $PATH
- Configure and compile Python with Zlib
- How to configure Eclipse for Python programming
- python代码制作configure文件的例子
- Configure PHP and Django (Python) to run on the same Apache site.
- The way to resolve 'dpkg: error processing python-xxx-xxxx (--configure): (But always install incomp
- How to Configure Eclipse for Python
- EasyPR win7 python3.4 vs2015 configure找不到vcprojs\\libeasypr.vcxp roj.template
- How to Configure Eclipse for Python
- 用python代码做configure文件
- 安装Python2.7出现configure: error: no acceptable C compiler found in $PATH错误
- linux下安装python3.3.3,configure后再make,一直重复configure运行的结果信息
- 为什么你用python3.6 编译dbus-python告诉你configure: error: could not find Python headers
- Python3.6安装报错 configure: error: no acceptable C compiler found in $PATH
- ERR! configure error gyp ERR! stack Error: Can't find Python executable "python"
- Configure python plug-in in eclipse