save a text file from web python code example
Example 1: python download file from url
import requests
url = 'https://www.facebook.com/favicon.ico'
r = requests.get(url, allow_redirects=True)
open('facebook.ico', 'wb').write(r.content)
Example 2: save a text file from web python
import urllib2response = urllib2.urlopen('https://wordpress.org/plugins/about/readme.txt')data = response.read()print(data)