Last active
August 29, 2015 14:04
-
-
Save william20111/81f415f2c7297592b8a2 to your computer and use it in GitHub Desktop.
RBS league
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
from bs4 import BeautifulSoup | |
from urllib import request | |
link = 'http://www.scottishrugby.org/fixtures-results?competition=98778&qt-fixtures_results_list=2#qt-fixtures_results_list' | |
x = request.urlopen(link) | |
html = x.read() | |
soup = BeautifulSoup(html) | |
league = [] | |
table = soup.find("table", {"class": "sticky-enabled"}) | |
for row in table: | |
if row is not None: | |
for col in row: | |
for td in col: | |
for x in td: | |
league.append(x) | |
frmt = "{} | {} | {} | {} | {} | {} | {} | {} | {} | {} | {}" | |
z = 15 | |
print(frmt.format(league[1].ljust(4), league[2].ljust(24), league[3].ljust(2), league[4].ljust(2), league[5].ljust(2), league[6].ljust(2), league[7].ljust(6), league[8].ljust(5), league[9].ljust(5), league[10].ljust(2), league[11].ljust(2))) | |
for line in league: | |
print(frmt.format(league[z].ljust(4), league[z+2].ljust(24), league[z+3].ljust(2), league[z+4].ljust(2), league[z+5].ljust(2), league[z+6].ljust(2), league[z+7].ljust(6), league[z+8].ljust(5), league[z+9].ljust(5), league[z+10].ljust(2), league[z+11].ljust(2))) | |
z += 14 | |
if z > 170: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment