示例#1
0
from scrape.mlb_scraper import GameStatus, InningPart
from scrape.mlb_scraper_mlb_api import MlbScraperMlbApi
from scrape.mlb_scraper_cbs import MlbScraperCbs

mlb = MlbScraperMlbApi()

wins, losses = mlb.getTeamRecord("STL");

print("Record: " + str(wins) + "-" + str(losses))
示例#2
0
from scrape.mlb_scraper_mlb_api import MlbScraperMlbApi

mlb = MlbScraperMlbApi()

wins, losses = mlb.getTeamRecord("WAS");

print("Record: " + str(wins) + "-" + str(losses))
示例#3
0
from scrape.mlb_scraper import GameStatus, InningPart
from scrape.mlb_scraper_mlb_api import MlbScraperMlbApi
from scrape.mlb_scraper_cbs import MlbScraperCbs

mlb = MlbScraperMlbApi()

standings = mlb.getDivisionStandings(input("Enter division: "));

# Example table with garbage data
#  _____________________________
# |  #  | Team|   W |   L |  GB |
# |=============================|
# |  1. | STL |  90 | 100 |  1.0|
# |  2. | CHI | 100 |  10 |-10.0|
# |  3. | PIT |   3 |   5 |  2.5|
#  -----------------------------

print(" _____________________________")
print("|  #  | Team|   W |   L |  GB |")
print("|=============================|")

for index, team in enumerate(standings):
    positionString = "|" + "{:3d}".format(index + 1) + ". |"
    rowString = positionString

    teamString = "{:>4s}".format(team["name"]) + " |"
    rowString += teamString

    winString = "{:4d}".format(team["wins"]) + " |"
    rowString += winString
示例#4
0
import sys
import os
import datetime
import time

from scrape.mlb_scraper_mlb_api import MlbScraperMlbApi

mlb = MlbScraperMlbApi()

argError = False
date = None
team = None

if len(sys.argv) > 3:
    argError = True

if len(sys.argv) > 1:
    sys.argv[1] = sys.argv[1].replace("-", "")
    if sys.argv[1].isdigit():
        try:
            date = datetime.date(int(sys.argv[1][0:4]), int(sys.argv[1][4:6]), int(sys.argv[1][6:8]))
        except:
            argError = True
    else:
        team = sys.argv[1]
        
if len(sys.argv) > 2:
    sys.argv[2] = sys.argv[2].replace("-", "")
    if sys.argv[2].isdigit():
        if date is None:
            try: