python读取ini配置文件

2015-06-24 0 720
python读取ini配置文件
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import ConfigParser
 
# Open a configuration file
config = ConfigParser.SafeConfigParser()
config.read("config.ini")
 
# Read the whole configuration file
for section in config.sections():
    print "In section %s" % section
    for (key, value) in config.items(section):
        print "  Key %s has value %s" % (key, value)

遇见资源网 python python读取ini配置文件 http://www.ox520.com/15570.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务