特别需要注意的是data =urllib.parse.urlencode(values).encode(encoding='UTF8') 还要在编码成utf
import urllib
import urllib.request
import urllib.parse
url = "https://umbra.nascom.nasa.gov/cgi-bin/eit-catalog.cgi"
values = {'obs_year':'2018','obs_month':'March','obs_day':'8'}
#这里需要解码
data =urllib.parse.urlencode(values).encode(encoding='UTF8')
request = urllib.request.Request(url,data=data)
print(urllib.request.urlopen(request).read())
来源:CSDN
作者:路人王_Zz
链接:https://blog.csdn.net/weixin_42143003/article/details/103764313