Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from bs4 import BeautifulSoup import requests import pandas as pd import re url="https://infopasazer.intercity.pl/?p=station&id=33605" html_content = requests.get(url) html_content.encoding = "utf-8" soup = BeautifulSoup(html_content.text, "lxml") gdp = soup.find_all("table", attrs={"class": "table table-delay mbn"}) print("Number of tables on site: ",len(gdp)) table1 = gdp[0] body = table1.find_all("tr") head = body[0] body_rows = body[1:] headings = ['Numer', 'Przewoznik', 'Data', 'Relacja', 'Przyjazd_plan', 'Opoznienie'] all_rows = [] for row_num in range(len(body_rows)): row = [] for row_item in body_rows[row_num].find_all("td"): aa = re.sub("(\xa0)|(\n)|,","",row_item.text) row.append(aa) all_rows.append(row) df = pd.DataFrame(data=all_rows,columns=headings) print(df)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)