-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy paththtag_LES.py
More file actions
31 lines (20 loc) · 761 Bytes
/
thtag_LES.py
File metadata and controls
31 lines (20 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Trouver tout les tag th dans le site web
# url = r"https://en.wikipedia.org/wiki/List_of_stations_of_the_Paris_M%C3%A9tro"
from bs4 import BeautifulSoup
import requests
#import urllib3
url = r"https://en.wikipedia.org/wiki/List_of_stations_of_the_Paris_M%C3%A9tro"
#--- Alternative ----
# http = urllib3.PoolManager()
# response = http.request('GET', url)
# soup_page = BeautifulSoup(response.data.decode('utf-8'), "html.parser")
response = requests.get(url)
soup_page = BeautifulSoup(response.content,"html.parser")
print(soup_page)
thtags = soup_page.find_all('th')
for t in thtags:
print(t.string)
print("---------------------------------- TH TAGS ------------------------------------------")
for t in thtags:
print(t)
# ou print(thtags)