[source code] Python Programming Tutorial - 22 - Download an Image from the Web

+4 Bucky Roberts · September 1, 2014

import random
import urllib.request


def download_web_image(url):
    name = random.randrange(1, 1000)
    full_name = str(name) + ".jpg"
    urllib.request.urlretrieve(url, full_name)

download_web_image("https://buckysroom.org/photos/users/2/resized/2463a86fdf42a1681c66ba8fd6789f9d.jpg")

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 James ciak · January 13, 2015
After coping the code directly. It works fine in Pycharm. I feel the error is on our part.
  • 1
  • 2

Python

106,978 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator