Answers for "python configure file"

6

python config file

''' config.cfg
[whatever]
key=qwerertyertywert2345
secret=sadfgwertgrtujdfgh
'''

from configparser import ConfigParser

config = ConfigParser()
config.read('config.cfg')

my_key = config['whatever']['key']
my_secret = config['whatever']['secret']
Posted by: Guest on January-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language