用户登录
用户注册

分享至

python读取ini配置文件

  • 作者: 你是我遥不可及的梦i39507074
  • 来源: 51数据库
  • 2022-08-12
#!/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)

软件
前端设计
程序设计
Java相关