python - String/dict manipulation ' to " -


{'coolstring': {'stepone': {'x': '44', 'y': '66'}}} 

this string/dictionary create input(), however, need change ' or apostrophes " or quotation marks. reasoning need passed json string further down pipeline.

my idea using .replace() i'm not quite sure how format swaps ' " tips?

if input dictionary, there's json module need:

import json  dic = {'coolstring': {'stepone': {'x': '44', 'y': '66'}}}  json_string = json.dumps(dic) print(json_string) 

the output be:

{"coolstring": {"stepone": {"x": "44", "y": "66"}}}

however if data string, can use proposed solution other comment using replace()


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -