[Tutor] How to set value back to .conf file
hok kakada
hokkakada at khmeros.info
Wed Mar 21 05:10:47 CET 2007
Hi all,
I just start to use ConfigParser to store the configuration for my
application.
I surfed the mails related to ConfigParser, however I couldn't found the way
of how to set value back to the .conf file.
Let say, I have a test.conf file with:
[General]
userName="da"
later on, I wanna add another option:
email="da at aa.info"
I did the following:
import ConfigParser
conf = ConfigParser.ConfigParser()
conf.read('test.conf')
conf.set('General', 'email', 'da at aa.info'
print conf.items('General')
[('username','da'),('email','da at aa.info')]
But when I look into the file test.conf directly, I didn't see the option
'email' . I don't know what I am missing here?
Or i need to write it to the file using conf.write(fp)?
If so, how can I get this file pointer?
Thanks very much for your input.
da
--
Ms.Kakada Hok
Open Source Engineer
KhmerOS project
Open Institute Organization
H/P:(+855-12) 653 155
More information about the Tutor
mailing list