Created
June 29, 2015 15:52
-
-
Save wasi0013/bfcfe0201438f48acf3e to your computer and use it in GitHub Desktop.
parses spoj's Bangladesh ranklist (http://www.spoj.com/ranks/users/BD/) to get 100 top users of Spoj from country Bangladesh
This file contains 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
__author__ = "wasi0013" | |
""" | |
parses spoj's Bangladesh ranklist (http://www.spoj.com/ranks/users/BD/) to get | |
100 top users of Spoj from country Bangladesh | |
""" | |
import requests, bs4 | |
url = 'http://spoj.com/ranks/users/BD' | |
def get_user(): | |
response = requests.get(url) | |
soup = bs4.BeautifulSoup(response.text) | |
table = soup.select('div.row table') | |
rows = [row.select('tr') for row in table][0] | |
for td in rows: | |
print "" | |
for items in zip(['ranking', "name", "classical(problems)", "challenge", "points"], [row.getText() for row in td.select('td')]): | |
print(items[0]+": "+items[1]) | |
get_user() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment