import spreadsheet

This commit is contained in:
“christopheseux”
2023-05-08 18:25:04 +02:00
parent 1ff1b37adb
commit 1ee883957f
7 changed files with 177 additions and 10 deletions
+10 -1
View File
@@ -140,4 +140,13 @@ def open_file(filepath, env=None, select=False):
cmd += [str(filepath)]
subprocess.Popen(cmd, env=env)
subprocess.Popen(cmd, env=env)
def parse(string, template):
template = re.sub(r'{index:(.+?)}', r'(?P<index>.+)', template)
reg = re.sub(r'{(.+?)}', r'(?P<_\1>.+)', template)
values = list(re.search(reg, string).groups())
keys = re.findall(r'{(.+?)}', template) + ['index']
return dict(zip(keys, values))