Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> from ConfigParser import ConfigParser
- >>> from StringIO import StringIO
- >>> fh = StringIO("""
- ... [Some Section]
- ... spam: eggs
- ... spam: ham
- ... """)
- >>> parser = ConfigParser()
- >>> parser.readfp(fh)
- >>> print parser.items('Some Section')
- [('spam', 'ham')]
- [Ignored Paths]
- ignore-extension: .swp
- ignore-filename: tags
- ignore-directory: bin
- [('spam', 'eggs'), ('spam', 'ham')]
- parser.get('Some Section', 'spam')
- [Some Section]
- spam: eggs, ham
- spam_values = [v.strip() for v in parser.get('Some Section', 'spam').split(',')]
Add Comment
Please, Sign In to add comment