Crossin的编程教室
标题:
这是为啥
[打印本页]
作者:
东东哥
时间:
2018-12-24 23:48
标题:
这是为啥
#!usr/bin/python
# coding=UTF-8
import urllib2
from bs4 import BeautifulSoup
print '豆瓣正在热映:'
url="http://movie.douban.com"
html=urllib2.urlopen(url).read()
soup=BeautifulSoup(html)
div_hot=soup.find('div',{"id":"sceeening"})
for i in div_hot.find_all('li',class_='title'):
movie_title=i.a.get_text()
#movie_title = movie_title.strip() #去除movie_title两边的空格
print movie_title
print '\n豆瓣近期热门:'
div_new=soup.find('div',{"id":"new-movies"})
for i in div_new.find_all('li',class_='title'):
movie_new=i.a.get_text
print movie_new
复制代码
File "D:\Python\python27\lib\site-packages\beautifulsoup4-4.6.3-py2.7.egg\bs4\dammit.py", line 14, in <module>
from html.entities import codepoint2name
ImportError: No module named html.entities
作者:
crossin先生
时间:
2018-12-25 17:35
试下装个库 pip install future
或者改用 python3
欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/)
Powered by Discuz! X2.5