Skip to content
Snippets Groups Projects
Commit 4d29c535 authored by Riccardo Sellari's avatar Riccardo Sellari
Browse files

working on the regex

parent 04e57ed1
No related branches found
No related tags found
No related merge requests found
......@@ -9,17 +9,19 @@ import re
def findTheKey(path, clientMemcached):
with open(path,'r') as configFile:
data = {}
pattern = r'\"(.+)\":(.+),'
pattern = r'^"(.+)":(.+,(( ←)|[^a-zA-Z ]))'
for line in configFile:
match = re.search(pattern,line)
if(match):
match = re.search(pattern,line)
data[match.group(1)] = match.group(2)
print (data)
parameter = re.sub(r',|"|( ←)',"",match.group(2))
data[match.group(1)] = parameter
if(line.find('keybind') != -1):
match = re.search(pattern,line)
parameter = re.sub(r',|"|( ←)',"",match.group(2))
data[match.group(1)] = parameter
#value
parser = argparse.ArgumentParser()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment