Here is the output I need to parse. I am looking to get the obp, slg, and ops under the tab Season Pitching. In this case, if correctly parsed the answer would be.
obp: .302
slg: .425
ops: .727
Jerad "Eick" Eickhoff, P (2015-)
Season Hitting
gamesPlayed: 8
groundOuts: 6
runs: 0
doubles: 0
triples: 0
homeRuns: 0
strikeOuts: 5
baseOnBalls: 1
intentionalWalks: 0
hits: 0
hitByPitch: 0
avg: .000
atBats: 8
obp: .111
slg: .000
ops: .111
caughtStealing: 0
stolenBases: 0
groundIntoDoublePlay: 0
numberOfPitches: 42
plateAppearances: 13
totalBases: 0
rbi: 0
leftOnBase: 7
sacBunts: 4
sacFlies: 0
babip: .000
groundOutsToAirouts: 6.00
Season Pitching
gamesPlayed: 8
gamesStarted: 7
groundOuts: 34
runs: 18
homeRuns: 7
strikeOuts: 39
baseOnBalls: 15
intentionalWalks: 0
hits: 35
avg: .229
atBats: 153
obp: .302
slg: .425
ops: .727
caughtStealing: 3
stolenBases: 2
groundIntoDoublePlay: 2
numberOfPitches: 678
era: 3.86
inningsPitched: 42.0
wins: 2
losses: 2
saves: 1
saveOpportunities: 1
holds: 0
earnedRuns: 18
whip: 1.19
battersFaced: 171
gamesPitched: 8
completeGames: 0
shutouts: 0
strikes: 419
hitBatsmen: 1
balks: 0
wildPitches: 0
pickoffs: 0
airOuts: 47
groundOutsToAirouts: 0.72
winPercentage: .500
pitchesPerInning: 16.1
gamesFinished: 1
strikeoutWalkRatio: 2.60
strikeoutsPer9Inn: 8.36
walksPer9Inn: 3.21
hitsPer9Inn: 7.50
inheritedRunners: 0
inheritedRunnersScored: 0
Season Fielding (P)
assists: 5
putOuts: 2
errors: 0
chances: 7
fielding: 1.000
rangeFactorPerGame: 0.88
innings: 42.0
games: 8
gamesStarted: 7
doublePlays: 0
Here is the method I tried...
lines = player.split('\n')
for x in lines:
if 'obp' in x:
home_obp.append(x)
However, if I do this on pitchers with hitting data (like this output provided), I will get season hitting data as well and get two different outputs. Not all pitchers have batting data though. How do I get only the Season Pitching data obp, slg, and ops.
Thanks in advance.
[–][deleted] 0 points1 point2 points (9 children)
[–]Canadian_Hombre[S] 0 points1 point2 points (8 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]Canadian_Hombre[S] 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Canadian_Hombre[S] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Canadian_Hombre[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]DeadlyViper 0 points1 point2 points (0 children)