Created
June 18, 2016 09:13
-
-
Save codecakes/4670cdfe5a52bda7a6fbd5869c7f5fde to your computer and use it in GitHub Desktop.
If you had a filter to filter all htm incoming raw string using BeautifulSoup
This file contains hidden or 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 __future__ import unicode_literals | |
| from BeautifulSoup import BeautifulStoneSoup | |
| def html_decoder(s): | |
| return BeautifulStoneSoup(s, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) | |
| if __name__ == "__main__": | |
| s = "U.S. Adviser’s Blunt Memo on Iraq: Time ‘to Go Home’" | |
| print html_decoder(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment