I need to remove quotes in string from keys. Here is a code:
import re
mystr = '["key": val, "key2": val, "key3": v, "key5": 34, "key6": "ef"]'
key_pattern = "(\"(?P<key>\w+)\": )"
pattern = re.compile(key_pattern)
print(re.sub(pattern, "\key", mystr))
This is not working. I need to get the result:
mystr = '[key: val, key2: val, key3: v, key5: 34, key6: "ef"]'