Last active
October 26, 2019 08:05
-
-
Save myfreax/f260cbb298582637e5e3e7ead609eb54 to your computer and use it in GitHub Desktop.
BeautifulSoup remove html element attrs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
with open("mock/scrapy-post.html") as fp: | |
sp = BeautifulSoup(fp,features="lxml") | |
childs = sp.find('body').children | |
for element in childs: | |
element.attrs = {} | |
print(element) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment