diff options
author | lassulus <lassulus@googlemail.com> | 2013-12-16 16:23:12 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-12-16 16:23:12 +0100 |
commit | 8e7f6b0c15db735fd289b304cb9fa5337f53c4fc (patch) | |
tree | 2884f85bdc90e1d68427239744f5fe95c3fa2d3e /Reaktor/IRC/getconf.py | |
parent | 2c4426db77bfb4531d50418add76c98940c5181f (diff) |
Reaktor/IRC: use config.json (and python3ize)
Diffstat (limited to 'Reaktor/IRC/getconf.py')
-rw-r--r-- | Reaktor/IRC/getconf.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Reaktor/IRC/getconf.py b/Reaktor/IRC/getconf.py new file mode 100644 index 00000000..5fdd1cdb --- /dev/null +++ b/Reaktor/IRC/getconf.py @@ -0,0 +1,20 @@ +#getconf = make_getconf("dateiname.json") +#getconf(key) -> value +#oder error + +import json + +def make_getconf(filename): + def getconf(prop): + prop_split = prop.split('.') + string = '' + file = open(filename) + for line in file.readlines(): + string+=line + parsed = json.loads(string) + tmp = parsed + for pr in prop_split: + tmp = tmp[pr] + + return tmp + return getconf |