[code.view]

[top] / python / PyMOTW / ConfigParser / ConfigParser_populate.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Default handling.
     """
     #end_pymotw_header
     
     import ConfigParser
     
     parser = ConfigParser.SafeConfigParser()
     
     parser.add_section('bug_tracker')
     parser.set('bug_tracker', 'url', 'http://localhost:8080/bugs')
     parser.set('bug_tracker', 'username', 'dhellmann')
     parser.set('bug_tracker', 'password', 'secret')
     
     for section in parser.sections():
         print section
         for name, value in parser.items(section):
             print '  %s = %r' % (name, value)
     

[top] / python / PyMOTW / ConfigParser / ConfigParser_populate.py

contact | logmethods.com