我在 Windows 7 上全新安装了 Python 3.3.2。我正在尝试导入html.parser.HTMLParser,使用文档中的示例:Simple HTML and XHTML parser
但我得到了错误:
>>> from html.parser import HTMLParser
aee4
gg2
Traceback (most recent call last):
File "htmlang.py", line 1, in <module>
from html.parser import HTMLParser
File "c:\Python33\lib\html\parser.py", line 13, in <module>
import warnings
File "c:\Python33\lib\warnings.py", line 6, in <module>
import linecache
File "c:\Python33\lib\linecache.py", line 10, in <module>
import tokenize
File "c:\Python33\lib\tokenize.py", line 37, in <module>
__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
AttributeError: 'module' object has no attribute '__all__'
我刚刚打开解释器并输入了导入行。为什么它没有按预期工作?为什么要打印奇怪的“aee4”和“gg2”字符串?