Python 标准库 ConfigParser 模块 的使用 demo
#!/usr/bin/env python
# coding=utf-8 import ConfigParser
import sys
config = ConfigParser.ConfigParser()
#写入
config.add_section("Inc_basic")
config.set("Inc_basic","name","iPIN")
config.set("Inc_basic","tag","创业 / 互联网 / 大数据")
config.set("Inc_basic","scale","50~100人") config.add_section("Demand")
config.set("Demand","sex","男女不限")
config.set("Demand","degree","本科以上")
config.set("Demand","major","计算机相关") config.write(sys.stdout)
config.write(open("ConfigParser_demo.txt","w")) # 读取
config.read("./ConfigParser_demo.txt")
print config.get("Inc_basic","name")
print config.get("Demand","degree")