Mine
public text v1 · immutableimport json
def loadConfig(path):
with open(path) as f:
obj = json.load(f)
def get(key):
parts = key.split(".")
# start up in the root
subobj = obj
for part in parts:
if not part in subobj:
raise KeyError
subobj = part
return subobj
return get
get = loadConfig("config.json")