s = '{"title": "Fetching all Jobs from \"host_name\"."}'
j = json.loads(s)
print(j)
ValueError: Expecting , delimiter: line 1 column 36 (char 35)
犯罪嫌疑人X
浏览 1124回答 5
5回答
白板的微信
你真的首先需要一个字符串吗?s = {"title": 'Fetching all Jobs from "host_name".'}# If you want a string, then hereimport jsonj = json.dumps(s)print(j)回收值看起来像这样{"title": "Fetching all Jobs from \"host_name\"."}>>> s2 = r'{"title": "Fetching all Jobs from \"host_name\"."}'>>> json.loads(s2){'title': 'Fetching all Jobs from "host_name".'}
这会帮助你>>> import json>>> s= json.dumps('{"title": "Fetching all Jobs from \"host_name\"."}')>>> j=json.loads(s)>>> print(j){"title": "Fetching all Jobs from "host_name"."}