在python中将json转换为字符串
一开始我没有清楚地解释我的问题。在JSON中将json转换为字符串时,请尝试使用str()和json.dumps()。 >>> data = {'jsonKey': 'jsonValue',"title": "hello world"} >>> print json.dumps(data) {"jsonKey": "jsonValue", "title": "hello world"} >>> print str(data) {'jsonKey': 'jsonValue', 'title': 'hello world'} >>> json.dumps(data) '{"jsonKey": "jsonValue", "title": "hello world"}' >>> str(data) "{'jsonKey': 'jsonValue', 'title': 'hello world'}" 我的问题是: >>> data = {'jsonKey': 'jsonValue',"title": "hello world'"} >>> str(data) '{\'jsonKey\': \'jsonValue\', …