background image
cf.set(
"db"
,
"db_pass"
,
"zhaowei"
)
cf.write(open(
"
test.conf"
,
"w"
))
# 写文件
import
ConfigParser
config = ConfigParser.ConfigParser()
# set a number of parameters
config.add_section(
"book"
)
config.set(
"book"
,
"title"
,
"the python standard library"
)
config.set(
"book"
,
"author"
,
"fredrik lundh"
)
config.add_section(
"ematter"
)
config.set(
"ematter"
,
"pages"
, 250)
# write to file
config.write(open(
'1.ini'
,
"w"
))