Created
March 31, 2016 08:21
-
-
Save ywchiu/758612bb325a595519eea7116a489763 to your computer and use it in GitHub Desktop.
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 as bs | |
html = """ | |
<div class="aaa"> | |
Hello,how are you? | |
<a>wwww</a> | |
<strong>yyy</strong> | |
I'am fine. | |
</div> | |
""" | |
soup = bs(html, 'html5lib') | |
soup.strong.decompose() | |
soup.a.decompose() | |
print soup.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment