I am new to programing in general and was tasked with downloading an image using python, however I am having trouble getting any image. For an example I am using:
urllib.urlretrieve(i.imgur.com/oFwqoz6.png, Meme.png)
and always receive the say error which is:
IOError: [Errno 2] No such file or directory: 'i.imgur.com/oFwqoz6.png'
this baffles me due to the link working in the web browser, am I missing something simple here?
As simple as this:
import urllib
urllib.urlretrieve("http://i.imgur.com/oFwqoz6.png", "local-filename.png")
This is a simple task for Python and there are many ways to solve this, after I searched for a few seconds I found many answer for this question:
How to save an image locally using Python whose URL address I already know?
Downloading a picture via urllib and python
What I'm trying to say is that you should try to research a little bit more before formulating a question. Always post code that works, to make sure we can replicate any error you're getting.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.