[英]How to return JSON format from urlopen() response?
I am newbie to python and when trying such a code, I got weird characters.我是 python 的新手,在尝试这样的代码时,我得到了奇怪的字符。
import json
from urllib.request import urlopen
with urlopen(
"http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=MSFT®ion=1&lang=en") \
as response:
source = response.read()
print(source)
I expect the response to be JSON format but I got weird response like this:我希望响应是 JSON 格式,但我得到了这样的奇怪响应:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.