Simple python program to download an image from WWW

Hey, everyone this is a python program that you can download any image from internet by only providing the image url.




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

user_url = input("Enter the image url: ")
download_web_image(user_url)

try this out if you have any ideas about this just let me know. and please share and comment.

Comments