I want to create a config file if does not exist.  If I don't find it I 
create it by open(inifile, 'w') and the following code handles it as if 
I created it and added to it.

     try:
         f = open(inifile, 'r')
     except:
         f = open(inifile, 'w')

     cp = ConfigParser.ConfigParser()
     cp.readfp(f)

     if not cp.has_section(s):
         cp.add_section(s)

     cp.set(s, o, value)

     f = open(inifile, 'w')
     cp.write(f)

     f.close()

Is it true that you can read a file opened for write?

If so, cool.

-- 
Jeff

Jeff Johnson
[EMAIL PROTECTED]
SanDC, Inc.
623-582-0323
Fax 623-869-0675


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to