File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -1598,15 +1598,15 @@ Scraping
1598
1598
# $ pip3 install requests beautifulsoup4
1599
1599
>> > import requests
1600
1600
>> > from bs4 import BeautifulSoup
1601
- >> > url = ' https://en.wikipedia.org/wiki/Python_(programming_language)'
1602
- >> > page = requests.get(url)
1603
- >> > document = BeautifulSoup(page.text, ' html.parser' )
1604
- >> > table = document .find(' table' , class_ = ' infobox vevent' )
1605
- >> > rows = table.find_all(' tr' )
1606
- >> > link = rows[11 ].find(' a' )[' href' ]
1607
- ' https://www.python.org/ '
1608
- >> > latest_v = rows[ 6 ].find( ' div ' ).text.split()[ 0 ]
1609
- ' 3.7.2'
1601
+ >> > url = ' https://en.wikipedia.org/wiki/Python_(programming_language)'
1602
+ >> > page = requests.get(url)
1603
+ >> > doc = BeautifulSoup(page.text, ' html.parser' )
1604
+ >> > table = doc .find(' table' , class_ = ' infobox vevent' )
1605
+ >> > rows = table.find_all(' tr' )
1606
+ >> > link = rows[11 ].find(' a' )[' href' ]
1607
+ >> > ver = rows[ 6 ].find( ' div ' ).text.split()[ 0 ]
1608
+ >> > link, ver
1609
+ ( ' https://www.python.org/ ' , ' 3.7.2' )
1610
1610
```
1611
1611
1612
1612
You can’t perform that action at this time.
0 commit comments