Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #--*--coding: utf-8--*--
- import ConfigParser
- def read_param(filename='config.ini', section='mysql'):
- config = ConfigParser.ConfigParser()
- config.read('config.ini')
- db ={}
- if config.has_section(section):
- items = config.items(section)
- for item in items:
- db[item[0]] = item[1]
- else:
- raise Exception('{0} not found in the {1} file'.format(section, filename))
- print db
- read_param()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement