Sunday, 12 February 2017

Python Tutorial - 22 (download images program)



Code used -



import random
import urllib.request


def download_image (url):

    name = random.randrange (1,100)
    full_name = str(name) + ".jpg"
    urllib.request.urlretrieve(url, full_name)

download_image ("http://lh3.googleusercontent.com/-xjnSFrQVzVU/AAAAAAAAAAI/AAAAAAAAAIg/REdMyShEqhc/s80-c/photo.jpg")



Posts -









No comments:

Post a Comment