Skip to content

Commit 7afda2a

Browse files
committed
Olympics improved
1 parent 984d5c1 commit 7afda2a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

20191008/Exercises/.ipynb_checkpoints/Olympics-checkpoint.ipynb

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
"outputs": [],
3232
"source": [
3333
"www = 'https://www.olympic.org'\n",
34-
"r = requests.get(f'{www}/sport')\n",
34+
"r = requests.get(f'{www}/sports')\n",
3535
"soup = BeautifulSoup(r.text,'lxml')\n",
3636
"\n",
37-
"for sport in soup.select('ul.countries li'):\n",
37+
"summergames = soup.select(\"#summer-sports a\")\n",
38+
"for sport in summergames:\n",
3839
" print(sport.text.strip())"
3940
]
4041
},
@@ -66,8 +67,8 @@
6667
"outputs": [],
6768
"source": [
6869
"# Then loop through all sports\n",
69-
"for sport in soup.select('ul.countries li'):\n",
70-
" sp = sport.a['href']\n",
70+
"for sport in soup.select('#summer-sports a'):\n",
71+
" sp = sport['href']\n",
7172
" r = requests.get(f'{www}{sp}')\n",
7273
" s = BeautifulSoup(r.text,'lxml')\n",
7374
" for i in s.select('section.sport-events ul li'):\n",

0 commit comments

Comments
 (0)