We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1761410 commit 1ec8a76Copy full SHA for 1ec8a76
roundup/dehtml.py
@@ -24,8 +24,14 @@ def html2text(html):
24
raise ImportError # use
25
except ImportError:
26
# use the fallback below if beautiful soup is not installed.
27
- from HTMLParser import HTMLParser
28
- from htmlentitydefs import name2codepoint
+ try:
+ # Python 3+.
29
+ from html.parser import HTMLParser
30
+ from html.entities import name2codepoint
31
+ except ImportError:
32
+ # Python 2.
33
+ from HTMLParser import HTMLParser
34
+ from htmlentitydefs import name2codepoint
35
36
class DumbHTMLParser(HTMLParser):
37
# class attribute
0 commit comments