File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2292,8 +2292,8 @@ Scraping
2292
2292
import requests
2293
2293
from bs4 import BeautifulSoup
2294
2294
url = ' https://en.wikipedia.org/wiki/Python_(programming_language)'
2295
- resp = requests.get(url)
2296
- doc = BeautifulSoup(resp.text , ' html.parser' )
2295
+ html = requests.get(url).text
2296
+ doc = BeautifulSoup(html , ' html.parser' )
2297
2297
table = doc.find(' table' , class_ = ' infobox vevent' )
2298
2298
rows = table.find_all(' tr' )
2299
2299
link = rows[11 ].find(' a' )[' href' ]
Original file line number Diff line number Diff line change 1973
1973
< span class ="hljs-keyword "> import</ span > requests
1974
1974
< span class ="hljs-keyword "> from</ span > bs4 < span class ="hljs-keyword "> import</ span > BeautifulSoup
1975
1975
url = < span class ="hljs-string "> 'https://en.wikipedia.org/wiki/Python_(programming_language)'</ span >
1976
- resp = requests.get(url)
1977
- doc = BeautifulSoup(resp.text , < span class ="hljs-string "> 'html.parser'</ span > )
1976
+ html = requests.get(url).text
1977
+ doc = BeautifulSoup(html , < span class ="hljs-string "> 'html.parser'</ span > )
1978
1978
table = doc.find(< span class ="hljs-string "> 'table'</ span > , class_=< span class ="hljs-string "> 'infobox vevent'</ span > )
1979
1979
rows = table.find_all(< span class ="hljs-string "> 'tr'</ span > )
1980
1980
link = rows[< span class ="hljs-number "> 11</ span > ].find(< span class ="hljs-string "> 'a'</ span > )[< span class ="hljs-string "> 'href'</ span > ]
You can’t perform that action at this time.
0 commit comments