I have written this function that returns a dictionary
, I think either by itertools
or by just using yeild
i can return dictionary
but I have never done that in case of a dictionary
def configDb():
""" Reads git global config file
Returns:
config(dict): git config settings
"""
# Read git config file
configFile, _ = execGitCommand('git config --list')
config = {}
for line in (each for each in configFile.split("\n") if each):
config[line.split("=")[0]] = line.split("=")[-1]
return config
how can I make this function act in a way I do not have to call like configDb()
but instead just configDb[key]
should give me value ?