Python Forum
How can I target and scrape a data-stat
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I target and scrape a data-stat
#6
Make into list with text output then zip() it together.
Example.
>>> players = [tag.text for tag in players]
>>> assists = [tag.text for tag in assists]
>>> zip(player, assists)
<zip object at 0x000000001D9ED580>
>>> record = dict(zip(player, assists))
>>> record
{'Aaron Wan-Bissaka': '2',
 'Alex Telles': '1',
 'Amad Diallo': '',
 'Andreas Pereira': '',
 'Anthony Elanga': '0',
 'Anthony Martial': '0',
 'Brandon Williams': '29',
 'Bruno Fernandes': '0',
 'Cristiano Ronaldo': '1',
 'Daniel James': '0',
 'David de Gea': '5',
 'Dean Henderson': '',
 'Diogo Dalot': '2',
 'Donny van de Beek': '',
 'Edinson Cavani': '0',
 'Eric Bailly': '0',
 'Fred': '3',
 'Harry Maguire': '0',
 'Jadon Sancho': '0',
 'Jesse Lingard': '0',
 'Juan Mata': '',
 'Luke Shaw': '2',
 'Marcus Rashford': '7',
 'Mason Greenwood': '0',
 'Nemanja Matić': '1',
 'Paul Pogba': '1',
 'Phil Jones': '0',
 'Player': '0',
 'Raphaël Varane': '0',
 'Scott McTominay': '3',
 'Squad Total': '24',
 'Tom Heaton': '',
 'Victor Lindelöf': '1'}
>>> record['Brandon Williams']
'29'
Also look at Pandas it's great for reading table in from html.
Then have lot of power to finding eg statistic about players and games
Example NoteBook.
Reply


Messages In This Thread
RE: How can I target and scrape a data-stat - by snippsat - Feb-11-2022, 07:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to scrape data from HTML with no identifiers pythonpaul32 2 931 Dec-02-2023, 03:42 AM
Last Post: pythonpaul32
  I am trying to scrape data to broadcast it on Telegram BarryBoos 1 2,230 Jun-10-2023, 02:36 PM
Last Post: snippsat
  Is it possible to scrape this data from Google Searches rosjo 1 2,232 Nov-06-2020, 06:51 PM
Last Post: Larz60+
  [WinError 10061] No connection could be made because the target machine actively refu kannanponraj 1 8,474 May-10-2020, 10:39 AM
Last Post: Larz60+
  scrape data 1 go to next page scrape data 2 and so on alkaline3 6 5,305 Mar-13-2020, 07:59 PM
Last Post: alkaline3
  Want to scrape a table data and export it into CSV format tahir1990 9 5,364 Oct-22-2019, 08:03 AM
Last Post: buran
  webscrapping links and then enter those links to scrape data kirito85 2 3,257 Jun-13-2019, 02:23 AM
Last Post: kirito85
  Scrape ASPX data with python... hoff1022 0 4,566 Feb-26-2019, 06:16 PM
Last Post: hoff1022
  Target: Web Scraping / Web Automation vetabz 2 3,683 May-07-2017, 01:47 PM
Last Post: vetabz

Forum Jump:

User Panel Messages

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