I have a simple function to parse a .csv as follows
def grabber3(datafile):
with open(datafile, 'rb') as f:
r =csv.DictReader(f)
for line in r:
del line['thisthing']
print line
This print out each dict line correctly which is about 50 lines such as
{'NetworkStatus': '1', 'ID': '1469'}
{'NetworkStatus': '1', 'ID': '1470'}
etc etc
However I i want to return this when the function is called so I change the print statement to return as
def grabber3(datafile):
with open(datafile, 'rb') as f:
r =csv.DictReader(f)
for line in r:
del line['thisthing']
return line
but it only returns the first line
{'NetworkStatus': '1', 'ID': '1469'}
How do I return each line of the loop/all of the dict lines instead of just the first one?