from BeautifulSoup import BeautifulSoup
import re
doc = ['<html><head><title>Page title</title></head>',
'<body><p id="firstpara" align="center">This is paragraph <b>one</b>.',
'<p id="secondpara" align="blah">This is paragraph <b>two</b>.',
'</html>']
soup = BeautifulSoup(''.join(doc))
print soup.prettify()
但是不确定为什么会发生这种情况
Traceback (most recent call last):
File "C:\Python27\reading and writing xml file from web1.py", line 49, in <module>
from BeautifulSoup import BeautifulSoup
ImportError: No module named BeautifulSoup
请问你能帮个忙吗?谢谢!
easy_install
来使用 Python2.7,或者使用了随操作系统自带的 Python 版本?如果没有指定 2.7,请尝试使用 Python2.4 或 Python2.6。 - TyrantWave