读书人

[python3] sgmllib找不到解决方法

发布时间: 2012-02-08 19:52:21 作者: rapoo

[python3] sgmllib找不到
这几天看python的书籍,有一章讲的是 sgmllib这个库,但是我写了一个程序测试的时候提示说找不到 sgmllib这个库。
我装的python的版本是3.2的,找了一下安装目录,确实没有这个库。
不知道在python3里面还有没有这个库?还是这个库是第三方库了?还是该库被其他库取代了?

求解。。。

[解决办法]
python3.2的文档中似乎没有包含这个模块在里面,我看2.7版本的包含这个,3.2的没有。
[解决办法]
Another HTML parser which supports XHTML and offers a somewhat different interface is available in the HTMLParser module.

3.x没有sgmllib
[解决办法]

19.1 HTMLParser — Simple HTML and XHTML parser
Note: The HTMLParser module has been renamed to html.parser in Python 3.0.
python3里HTMLParser已经被重命名为html.parser


Deprecated since version 2.6: The sgmllib module has been removed in Python 3.0.
sgmllib在python3.0中已经被删除

19.2 html.parser — Simple HTML and XHTML parser


看The Python Library Reference Release 3.2吧,按模块索引html附近看看
这上面提到:
Another HTML parser which supports
XHTML and offers a somewhat different interface is available in the HTMLParser module.
那可能html.parser比较相近吧

读书人网 >perl python

热点推荐