I might be (probably am) using the wrong terminology for some of this, but here's what I'm trying to do.
This is the current code:
with open('matchup' + MatchupStr_Test + '_' + HomeAway[MatchupNum_Test] + 'team_name_NewTest.txt', 'w') as f:
f.write(str(box_scores[MatchupNum[MatchupNum_Test]].home_team.team_name))
I am attempting to take the word home from the second line (.home_team.team_name) and having it dynamically change so the word home would change depending on an array.
Here's what I thought would work, but doesn't.
with open('matchup' + MatchupStr_Test + '_' + HomeAway[MatchupNum_Test] + 'team_name_NewTest.txt', 'w') as f:
f.write(str(box_scores[MatchupNum[MatchupNum_Test]].[HomeAway[MatchupNum_Test]]_team.team_name))
Absolute beginner here, so sorry if I'm wording this in a confusing way. Just trying to have some fun on a Raspbi I wasn't currently using, so it doesn't have to be perfect.