Skip to content

Instantly share code, notes, and snippets.

@datamafia
Last active August 29, 2015 14:17
Show Gist options
  • Save datamafia/5bb9712797d8d8c45a49 to your computer and use it in GitHub Desktop.
Save datamafia/5bb9712797d8d8c45a49 to your computer and use it in GitHub Desktop.
MVP Proto for *.cfg reading (Python 2.7)
[section]
key=value
otherKey=otherValue
"""doc string"""
from __future__ import print_function
import os
from ConfigParser import SafeConfigParser
file_loc = os.path.dirname(os.path.realpath(__file__))+'/config.cfg'
parser = SafeConfigParser()
parser.read(file_loc)
print (parser.get('section','key'))
print (parser.get('section','otherKey'))
'''
value
otherValue
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment