I have a CSV file that I\'m reading in Python and I want the program to skip over the row if the first column is empty. How do I do this?
Right now I have:
I tried out what happens if you print and empty row and it returns [] (empty brackets)... so just check for that.
with open('testdata1.csv', 'rU') as csvfile: csvreader = csv.reader(csvfile) for row in csvreader: if row == []: continue #do stuff normally