I am learning to grab pictures from URL and found a Q&A here. Since it's Python 3, I changed import urllib
to import urllib.request
and
urllib.urlretrieve("http://www.digimouth.com/news/media/2011/09/google-logo.jpg", "local-filename.jpg")
to
urllib.request.urlretrieve("http://www.digimouth.com/news/media/2011/09/google-logo.jpg", "local-filename.jpg")
.
It doesn't work! It says AttributeError: 'module' object has no attribute 'urlretrieve'
I then changed urllib.urlretrieve
to def request.urlretrieve
and got SyntaxError: invalid syntax
I also tried def urlretrieve
and it's not working either.
Could anyone tell me how to get it right? Thanks!
What if the URL contains more than one pic?