공부

[python] single quote -> double quotes (str -> dict)

승가비 2023. 8. 26. 16:53
728x90
pip3 install seunggabi_core_python​
from seunggabi_core_python.util import json_util

json_util.pretty("{'User-Agent': 'python-requests/2.25.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'content-type': 'application/json', 'Content-Length': '40'}")

https://stackoverflow.com/questions/4162642/single-vs-double-quotes-in-json/76950751#76950751

 

Single vs double quotes in JSON

My code: import simplejson as json s = "{'username':'dfdsfdsf'}" #1 #s = '{"username":"dfdsfdsf"}' #2 j = json.loads(s) #1 definition is wrong #2 definition is right I heard that in Python that

stackoverflow.com

 

728x90