I need save the HTML code of any website in a txt file, is a very easy exercise but I have doubts with this because a have a function that do this:
import ur
I use Python 3.
pip install requests - after install requests library you can save a webpage in txt file.
import requests
url = "https://stackoverflow.com/questions/24297257/save-html-of-some-website-in-a-txt-file-with-python"
r = requests.get(url)
with open('file.txt', 'w') as file:
file.write(r.text)