【发布时间】:2018-07-20 10:53:00
【问题描述】:
如果有任何帮助,我将不胜感激
我正在从网站获取信息...而且通常一切正常...但是,只需查看代码:
r = requests.get(s_url)
print r.text
>>>[{"nameID":"D1","text":"I’ll understand what actually happened here."}]
print r.json()
>>>[{u'nameID':u'D1',u'text':u'I\u2019ll understand what actually happened
here.'"}]
正如您在 r.json() ' 更改为 \u2019 之后看到的。 为什么这样做?我怎样才能强制不进行此类更改?
谢谢
【问题讨论】:
-
你点击的网址
s_url是返回JSON还是纯文本? -
@EricWilson s_url 返回纯文本
-
看来你可以使用
r.text,对吧?我不确定你的问题是什么。
标签: python json python-2.7 python-requests