1import requests
2
3url = "https://stackoverflow.com/questions/24297257/save-html-of-some-website-in-a-txt-file-with-python"
4
5r = requests.get(url)
6with open('file.txt', 'w') as file:
7 file.write(r.text)
8
1import urllib.request
2urllib.request.urlretrieve("http://www.example.com/test.html", "test.txt")
3