Web scraping von Tabellen
Verfasst: Samstag 8. April 2023, 12:11
Sorry schon wieder ne Frage:
Hi@all,
Mein Code:
import requests
import pandas as pd
from bs4 import BeautifulSoup
url = 'https://www.jkg-wds.de/Schulintern/Vert ... st_001.htm'
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
rows = soup.find('table' , {'class':'mon_list'}).find_all('tr')
Vertretungsplan_list = []
for row in rows:
dic = {}
dic['Vertretungsplan'] = row.find_all('td')[0].text
dic
Vertretungsplan_list.append(dic)
print(Vertretungsplan_list)
Bei row.find_all("td")[0] bekomme ich die Fehlermeldung: list index out of range obwohl der index eigentlich stimmen müsste:
[img]file:///C:/Users/hans-/Pictures/Screenpresso/2023-04-08_13h29_06.png[/img]
Es würde mich freuen wenn ihr mir auch hier helfen könntet
Hi@all,
Mein Code:
import requests
import pandas as pd
from bs4 import BeautifulSoup
url = 'https://www.jkg-wds.de/Schulintern/Vert ... st_001.htm'
r = requests.get(url)
soup = BeautifulSoup(r.text, 'html.parser')
rows = soup.find('table' , {'class':'mon_list'}).find_all('tr')
Vertretungsplan_list = []
for row in rows:
dic = {}
dic['Vertretungsplan'] = row.find_all('td')[0].text
dic
Vertretungsplan_list.append(dic)
print(Vertretungsplan_list)
Bei row.find_all("td")[0] bekomme ich die Fehlermeldung: list index out of range obwohl der index eigentlich stimmen müsste:
[img]file:///C:/Users/hans-/Pictures/Screenpresso/2023-04-08_13h29_06.png[/img]
Es würde mich freuen wenn ihr mir auch hier helfen könntet