Created
December 2, 2013 10:43
-
-
Save homleen/7747787 to your computer and use it in GitHub Desktop.
豌豆荚 TOP 排行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding=utf8 | |
import urllib2 | |
from bs4 import BeautifulSoup | |
url = 'http://www.wandoujia.com/top' | |
opener = urllib2.build_opener() | |
content = opener.open(url).read() | |
dom = BeautifulSoup(content) | |
app_lists = dom.find_all("div", class_='app-rank') | |
for ndx, list in enumerate(app_lists): | |
print('----------') | |
print list.find('h2').string | |
print('----------') | |
apps = list.find_all('span', class_='txt') | |
for app in apps: | |
print app.string | |
print ('') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment