Skip to content

Instantly share code, notes, and snippets.

@Baekjoon
Last active August 29, 2015 14:19
Show Gist options
  • Save Baekjoon/a48d37bc569ed97ce098 to your computer and use it in GitHub Desktop.
Save Baekjoon/a48d37bc569ed97ce098 to your computer and use it in GitHub Desktop.
acmicpc-ranklist-print-rank-user_id-wrong
import urllib
from bs4 import BeautifulSoup
fp = urllib.urlopen('https://www.acmicpc.net/ranklist')
source = fp.read()
fp.close()
soup = BeautifulSoup(source)
table = soup.find(id="ranklist")
trs = table.tbody.find_all('tr')
for tr in trs[:10]:
tds = tr.find_all('td')
rank = tds[0].string
user_id = tds[1].string
print rank,user_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment