Skip to content

Instantly share code, notes, and snippets.

@tranchausky
Created August 7, 2019 08:25
Show Gist options
  • Save tranchausky/5c6c7903f46dedf0f71f7a94d0caa09c to your computer and use it in GitHub Desktop.
Save tranchausky/5c6c7903f46dedf0f71f7a94d0caa09c to your computer and use it in GitHub Desktop.
python save html tag data content website
from bs4 import BeautifulSoup
import requests
r = requests.get("https://stackoverflow.com/questions/47503845/save-html-content-into-a-txt-file-using-python")
data = r.text
soup = BeautifulSoup(data)
print(soup)
with open ('/tmp/test.html', 'a') as f:
f.write(str(soup))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment