I have a list of teams. I would like to go through this list of teams and for each team that exists in a row of a csv I would like to append it to a variable that I can call later.
Here is my code and I cant seem to get it to work.
object = input('Object ID')
my_list = ['team1', 'team2', 'team3', 'team4']
for i in my_list:
team_list = [i]
with open(latest_csv) as report:
reader = list(csv.reader(report, delimiter= ','))
def obj():
values = []
for row in reader:
if row[3] == team_list and row[14] == object:
values.append([row[3], row[4],row[5], row[14]])
return values```
example of csv file
|Country| City | State | Team Name| ..... | Object |
|-------|------|-------|----------|-------|--------|
|USA |Denver| CO | team1 | | 1 |
|USA |NY | NY | team2 | | 1 |
|USA |ATL | GA | team3 | | 2 |
|USA |Bost | MA | team4 | | 2 |