import urllib.request as request
from bs4 import BeautifulSoup
url='https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node'
#url='http://www.cityhouse.cn/default/leaserank.html'
soup=BeautifulSoup(request.urlopen(url),from_encoding='utf-8')
tables=soup.find_all('table')
for table in tables:
print(table)
换url='http://www.cityhouse.cn/default/leaserank.html'就正常
这两个页面都是utf-8编码
from bs4 import BeautifulSoup
url='https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node'
#url='http://www.cityhouse.cn/default/leaserank.html'
soup=BeautifulSoup(request.urlopen(url),from_encoding='utf-8')
tables=soup.find_all('table')
for table in tables:
print(table)
换url='http://www.cityhouse.cn/default/leaserank.html'就正常
这两个页面都是utf-8编码