k2nn3
2016-10-09 13:48
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from urllib import request
from bs4 import BeautifulSoup as bs
req=request.Request("http://www.baidu.com")
req.add_header("User-Agent","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36")
resp=request.urlopen(req)
soup=bs(resp,"html_parser")
print(soup.img)
Traceback (most recent call last):
File "C:/Users/Administrator.WIN7-20160710FD/PycharmProjects/untitled1/pc1.py", line 4, in <module>
from bs4 import BeautifulSoup as bs
ImportError: No module named 'bs4'
Process finished with exit code 1
这应该是你没有安装 BeautifulSoup4的缘故
python遇见数据采集
59669 学习 · 200 问题
相似问题