Python中的HTML解析器 [英] HTML parser in Python

查看:121
本文介绍了Python中的HTML解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Python文档我找到了 HTML解析器,但我不知道要导入哪个库来使用它,我如何找到它(记住它没有在页面上说)。

Using the Python Documentation I found the HTML parser but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page).

推荐答案

尝试:

import HTMLParser

在Python 3.0中,HTMLParser模块已重命名为html.parser
你可以查看这个这里

In Python 3.0, the HTMLParser module has been renamed to html.parser you can check about this here

Python 3.0

Python 3.0

import html.parser

Python 2.2及以上

Python 2.2 and above

import HTMLParser

这篇关于Python中的HTML解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆