Hole | Wins | Losses | Score | +36 |
---|---|---|---|---|
1 | 23 | 58 | +22 | (+3) |
10 | 31 | 50 | +36 | (E) |
Avg | 27 | 54 | +50 |
This appears to be a text file containing the results of baseball games played between various teams from 2007. The format is quite specific and easy to parse.
Here's a Python code snippet that can help you extract the relevant information:
import re
def game_result(game):
result = {}
# Pattern for home team
pattern_home = r" ([^:]+): ([0-9]+)-([0-9]+)"
# Pattern for away team
pattern_away = r" vs. ([^:]+): ([0-9]+)-([0-9]+)"
home_result = re.search(pattern_home, game)
if home_result:
result['home_team'] = home_result.group(1).strip()
result['home_wins'] = int(home_result.group(2))
result['home_loss'] = int(home_result.group(3))
away_result = re.search(pattern_away, game)
if away_result:
result['away_team'] = away_result.group(1).strip()
result['away_wins'] = int(away_result.group(2))
result['away_loss'] = int(away_result.group(3))
return result
# Example usage
with open('games.txt', 'r') as file:
for line in file:
print(game_result(line))
This script will take a game's results, and extract the home team, away team, their respective wins, and losses. It uses regular expressions to match the patterns in your text.
If you want to further process this data (e.g., calculate team stats, sort them by wins, etc.), you can add additional code or functions to handle that. Updated: June 5, 2025 at 5:40 AM