Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Imprt HTML table to array
#1
I have this piece of code to extract a table from a Wikipedia article.

import urllib.request
url = "https://en.wikipedia.org/wiki/List_of_London_Underground_stations"
page = urllib.request.urlopen(url)

from bs4 import BeautifulSoup
soup = BeautifulSoup(page, "lxml")

all_tables=soup.find_all("table")
all_tables

right_table=soup.find('table', class_='wikitable sortable plainrowheaders jquery-tablesorter')
print(right_table)
After print I get 'None' as output. What am I doing wrong?
Reply


Messages In This Thread
Imprt HTML table to array - by meleghengersor - Jan-22-2020, 04:15 PM
RE: Imprt HTML table to array - by Larz60+ - Jan-23-2020, 04:23 AM
RE: Imprt HTML table to array - by perfringo - Jan-23-2020, 10:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Suggestion request for scrapping html table Vkkindia 3 2,098 Dec-06-2021, 06:09 PM
Last Post: Larz60+
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,711 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Help: Beautiful Soup - Parsing HTML table ironfelix717 2 2,748 Oct-01-2020, 02:19 PM
Last Post: snippsat
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,403 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  BeautifulSoup: Error while extracting a value from an HTML table kawasso 3 3,295 Aug-25-2019, 01:13 AM
Last Post: kawasso
  convert html table to json bhojendra 5 16,096 Jul-30-2019, 07:53 PM
Last Post: DeaD_EyE
  How to capture Single Column from Web Html Table? ahmedwaqas92 5 4,481 Jul-29-2019, 02:17 AM
Last Post: ahmedwaqas92

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020