Skip to content

Instantly share code, notes, and snippets.

Created Nov 22, 2020
What would you like to do?
import requests
from bs4 import BeautifulSoup
import re
url = ""
def isNamedLine(tag):
return tag.has_attr('name')
websiteText = requests.get(url).text
soup = BeautifulSoup(websiteText, 'lxml')
lines = soup.find_all(isNamedLine)
with open('henryV.txt', "w") as outfile:
for l in lines:
outfile.write(str(l.text) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment