I got it.I just searched throgh the external libray and saw the module name is changed to urllib and its not urllib.request.
One more thing,i love programming and i just programmed c++ about two years ago and im interested in micro controllers such as ARM,AVR,...
I get started with python when i wanted to get familiar to raspberry boards.
Is there any books or videos that can help me learning about python more and more?
(Mar-13-2017, 01:55 PM)zivoni Wrote: As I wrote earlier, python2.7 does not have urllib.request library. You can either use python3 with your original code, or change your code to either use requests or urllib. This code should work with python 2.7 - uses just urllibyes that was my problem.import random import urllib def download_web_image(url): name=random.randrange(1,1000) fullname=str(name)+".jpg" urllib.urlretrieve(url,fullname) download_web_image("http://www.reef2reef.com/data/ams/431/431079-8956905e1ef117b2e057a39686ede6a4.jpg")EDIT: If you are just starting with python and following tutorial with python3 examples, you should install and use python 3.x instead of python 2.7
(Mar-13-2017, 01:48 PM)wavic Wrote: The module is requests with 's'. My bad. Which Python version do you use?I use pycharm2016.3.2
One more thing,i love programming and i just programmed c++ about two years ago and im interested in micro controllers such as ARM,AVR,...
I get started with python when i wanted to get familiar to raspberry boards.
Is there any books or videos that can help me learning about python more and more?