I'm trying to write a regex for the following situation. I have a file with hundreds of dictionaries as string.
EG:
{'a':1'}
{{'a':1, 'b':2}{'c':3}}
{'a':4, 'b':6}
I read the file and removed the newlines. Now I'm trying split them based on a regex.
{'a':1'}{{'a':1, 'b':2}{'c':3}}{'a':4, 'b':6}
re.split("({.*?})", str). This wouldn't work because the whole second dict wouldn't match. How can I write a regex that would match all the lines return a list of dictionaries.
1intentional? Thanks.{{'a':1, 'b':2}{'c':3}}is not valid Python syntax. If it's a single dictionary with nested dictionaries then it's missing keys and a comma, and if you treat it as two separate dictionaries then you have extra braces.json?