Guest User

Untitled

a guest
Feb 24th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. r = r"(s*('[^']+',s*)('[^']+',s*)('[^']+')s*)"
  2. sub = r'{"key1": 1"key2": 2"key3": 3}'
  3.  
  4. json = "[%s]" % re.sub(r, sub, text)
  5.  
  6. [{"key1": 'str10', "key2": 'str20', "key3": 'str30'}, {"key1": 'str11', "key2": 'str21', "key3": 'str31'}, {"key1": 'str11', "key2": 'str21', "key3": 'str31'}]
Add Comment
Please, Sign In to add comment