fork download
  1. import re
  2. with open('inp.txt', 'rt', encoding='utf-8') as f_inp:
  3. data = f_inp.read()
  4.  
  5. ii = re.finditer(r"^(?P<name>[a-zA-Z0-9_\-.]+)\s*{(?P<value>[^}]*)^\s*}", data, flags=re.MULTILINE)
  6. out = {c.group('name') : c.group('value') for c in ii}
  7. print(out)
  8.  
Runtime error #stdin #stdout #stderr 0.14s 23776KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
    with open('inp.txt', 'rt', encoding='utf-8') as f_inp:
FileNotFoundError: [Errno 2] No such file or directory: 'inp.txt'