Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/python-download-from-www/main.py
5925 views
1
import requests
2
3
4
def save_file_from_www(link):
5
filename = link.split('/')[-1]
6
r = requests.get(link, allow_redirects=True)
7
open(filename, 'wb').write(r.content)
8
9
10
link1 = 'https://raw.githubusercontent.com/WISEPLAT/python-code/master/python-xml/yandex_xml_zhilaya.xml'
11
link2 = 'https://raw.githubusercontent.com/WISEPLAT/python-code/master/python-xml/yandex_xml_commercial.xml'
12
link3 = 'https://www.culture.ru/storage/images/5cb82d851c1b7c86f5572a72874daa92/59108e2912262e451d2121b407846c44.jpg'
13
14
save_file_from_www(link1)
15
save_file_from_www(link2)
16
save_file_from_www(link3)
17
18