ich gelernt, wie man als ein Bild von einer bestimmten URL mit Python zum Download:mit Python ein Bild von bestimmten URL herunterladen
import urllib
imgurl="http://www.digimouth.com/news/media/2011/09/google-logo.jpg"
resource = urllib.urlopen(imgurl)
output = open("test.jpg","wb")
output.write(resource.read())
output.close()
und es hat gut funktioniert, aber wenn ich geändert, um die URL zu
imgurl="http://farm1.static.flickr.com/96/242125326_607a826afe_o.jpg"
es hat nicht funktioniert, und gab die Informationen
File "face_down.py", line 3, in <module>
resource = urllib2.urlopen(imgurl)
File "D:\Python27\another\Lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "D:\Python27\another\Lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "D:\Python27\another\Lib\urllib2.py", line 449, in _open
'_open', req)
File "D:\Python27\another\Lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "D:\Python27\another\Lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "D:\Python27\another\Lib\urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 10060] >
und ich versuchte, die letztere Bild-URL zu öffnen, und es COU ld gezeigt werden als der ehemalige, ich habe keine Ahnung, es zu lösen ~~ help ~~~~
Vielen Dank! Ich werde es versuchen! –
es zeigte immer noch die Fehler, und ich habe versucht, den ursprünglichen Code dann funktioniert es, so seltsam! Manchmal funktioniert es und manchmal nicht –