how to write special value to a config file with ConfigParser
Lialie
lialie at 126.com
Sun Apr 23 12:33:49 EDT 2006
Hello,all
I found it easy to read configures from a config file.
But how can I set a special value to an item or write it into the
original file?
I have tried this:
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('a.conf')
config.get('Main', 'Something') # That is OK.
config.set('Main', 'Something', '2') # without any fault
#fp = open('a.conf') # can not be done, raise Error
#fp = open('a.conf', 'a') # Something set to 2, but it copies the all items
#config.write(fp)
# How can I do it?
More information about the Python-list
mailing list