初始代码如下:结果报错(如下)和警告(略),# -*-coding:utf8-*- import requests from bs4 import BeautifulSoup url='http://movie.douban.com/top250' html=requests.get(url) soup=BeautifulSoup(html) print soup.title
后来将代码改成如下,解决了问题# -*-coding:utf8-*- import requests from bs4 import BeautifulSoup url='http://movie.douban.com/top250' html=requests.get(url) soup=BeautifulSoup(html.text,"lxml") print