1import requests
2
3file_url = 'https://www.journaldev.com/wp-content/uploads/2019/08/Python-Tutorial.png'
4
5file_object = requests.get(file_url)
6
7with open('Python-Tutorial.png', 'wb') as local_file:
8 local_file.write(file_object.content)
9
10#The file will be downloaded in the same directory as the Python script.
11#If you want to change the directory location,
12#you can provide a complete path or relative path in the open() function call.
13