= Introduction =
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML")
>>> print soup.prettify()
<html>
<body>
<p>
Some
<b>
bad
<i>
HTML
</i>
</b>
</p>
</body>
</html>
>>> soup.find(text="bad")
u'bad'
>>> soup.i
<i>HTML</i>
>>> soup = BeautifulSoup("<tag1>Some<tag2/>bad<tag3>XML", "xml")
>>> print soup.prettify()
<?xml version="1.0" encoding="utf-8">
<tag1>
Some
<tag2 />
bad
<tag3>
XML
</tag3>
</tag1>
= Full documentation =
The bs4/doc/ directory contains full documentation in Sphinx
format. Run "make html" in that directory to create HTML
documentation.
= Running the unit tests =
Beautiful Soup supports unit test discovery from the project root directory:
$ nosetests
$ python -m unittest discover -s bs4 # Python 2.7 and up
If you checked out the source tree, you should see a script in the
home directory called test-all-versions. This script will run the unit
tests under Python 2.7, then create a temporary Python 3 conversion of
the source and run the unit tests again under Python 3.
= Links =
Homepage: http://www.crummy.com/software/BeautifulSoup/bs4/
Documentation: http://www.crummy.com/software/BeautifulSoup/bs4/doc/
http://readthedocs.org/docs/beautiful-soup-4/
Discussion group: http://groups.google.com/group/beautifulsoup/
Development: https://code.launchpad.net/beautifulsoup/
Bug tracker: https://bugs.launchpad.net/beautifulsoup/
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
kml2shp_passerqi.zip (67个子文件)
kml2shp_passerqi
KMl2SHP
kml_to_shp.py 4KB
kml2shp.tbx 8KB
songbai.kml 3KB
beautifulsoup4-4.6.0
setup.py 1KB
convert-py3k 546B
doc.zh
Makefile 5KB
source
conf.py 8KB
COPYING.txt 1KB
test-all-versions 56B
bs4
__init__.py 20KB
tests
test_soup.py 20KB
test_htmlparser.py 1KB
__init__.py 27B
test_lxml.py 2KB
test_html5lib.py 5KB
test_builder_registry.py 5KB
test_tree.py 76KB
test_docs.py 1KB
element.py 67KB
builder
__init__.py 11KB
_lxml.py 9KB
_htmlparser.py 11KB
_html5lib.py 16KB
diagnose.py 7KB
dammit.py 29KB
testing.py 30KB
MANIFEST.in 203B
beautifulsoup4.egg-info
top_level.txt 4B
SOURCES.txt 866B
PKG-INFO 1012B
dependency_links.txt 1B
requires.txt 34B
build
bdist.win32
lib
bs4
__init__.py 20KB
tests
test_soup.py 20KB
test_htmlparser.py 1KB
__init__.py 27B
test_lxml.py 2KB
test_html5lib.py 5KB
test_builder_registry.py 5KB
test_tree.py 76KB
test_docs.py 1KB
element.py 67KB
builder
__init__.py 11KB
_lxml.py 9KB
_htmlparser.py 11KB
_html5lib.py 16KB
diagnose.py 7KB
dammit.py 29KB
testing.py 30KB
dist
beautifulsoup4-4.6.0-py2.7.egg 188KB
doc
Makefile 5KB
source
index.rst 104KB
conf.py 8KB
6.1.jpg 22KB
setup.cfg 59B
scripts
demonstrate_parser_differences.py 3KB
demonstration_markup.txt 3KB
PKG-INFO 991B
.idea
misc.xml 212B
workspace.xml 11KB
beautifulsoup4-4.6.0.iml 398B
modules.xml 292B
AUTHORS.txt 2KB
README.txt 1KB
NEWS.txt 48KB
TODO.txt 1KB
readme.txt 234B
共 67 条
- 1
geodoer
- 粉丝: 5970
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页