In this article, we will see how sports.py module is imported and implemented to produce scoreboard of a specified sport like baseball, basketball, cricket and many more along with other details about the sport. Code examples in the text below revolve around cricket, you can perform the same operation for any other sport.
Sport.py Scrapes data from:
Not all sports are supported by this module, all of which are supported are listed below along with their respective python code to reference them:
First, we need to install this module and for that just simply run the following code into your terminal:
pip install sports.py
- import module
- Get a single match using get_match()
get_match(sport, team1, team2)
get_match() returns a single Match object which contains the following properties:
|sport||Name of the sport|
|league||League of the match|
|home_score||Home team score|
|away_score||Away team score|
|match_time||Current match time|
|match_date||Date on which the match was played|
|match_link||Link to an XML file containing match data|
Program that prints all live cricket matches.
An application that produces cricket live scores using tkinter in a GUI format.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.