HTTP :HTTP:当我尝试执行Python2.7脚本时,返回的是HTTP错误404: Not,完整的跟踪位于https://pastebin.com/f7EzJ4zn,如何修复这个问题?
site = "https://askubuntu.com"
file_path = site + "/https://askubuntu.com/questions/1156044/what-is-this-
error-typeerror-unsupported-operand-types-for-instance-and/1156049#1156049"
import urllib2
server = urllib2.urlopen(site)
response = urllib2.urlopen(file_path)
print(response.read())编辑:问题解决了,当我需要Urllib2 HTTP 404时,我复制了完整的URL
site = "https://askubuntu.com"
file_path = "https://askubuntu.com/questions/1156065/urllib2-http-404"
import urllib2
server = urllib2.urlopen(site)
response = urllib2.urlopen(file_path)
print(response.read())发布于 2019-07-05 05:08:00
当然,您的URL是不正确的。
这就是404错误通常意味着什么:这样的文件或位置不存在。
在这种情况下,错误是显而易见的:您的"file_path“字符串是"https://askubuntu.com/https://askubuntu.com/questions/1156044/what-is-this- error-typeerror-unsupported-operand-types-for-instance-and/1156049#1156049",这显然是无效的。在网络浏览器中尝试一下,你就会看到。
https://askubuntu.com/questions/1156065
复制相似问题