I don't understand why the code below
with open('book.csv') as f:
reader = csv.reader(f, delimiter='\t')
for a in reader:
print(a)
returns empty cells too.
['username', '', '', '']
['\t\t\t\t', '', '', '']
['Name', 'Surname', '', '']
['Brian', 'Fespa', '', '']
['John', 'Mc', '', '']
['\t\t\t\t', '', '', '']
['Name', 'Surname', 'Age', 'Sex']
['Lauren', 'Fon', '15', 'F']
['Tim', 'Matthew ', '25', 'M']
My purpose is to calculate the length of the rows that have actually some data. For example, the first list ['username', '', '', ''] should return length of 1 and not 4. The second list ['\t\t\t\t', '', '', ''] should return 0 and not 4.
Any help is really appreciated. Thank you!
'1','','2'. should this show 2 or 3 since the middle is empty, should it be dropped?