Reputation: 21271
I have an input file where each line has 4 fields separated by commas. For example
a,b,c,d
Unfortunately, a small number of lines are broken and are missing fields. For example
a,,c,d
I currently use split to put the fields into a list. How can I check if any of the entries in this list are now empty?
Upvotes: 0
Views: 291
Reputation: 1039
Try something like this if you need to know which field is empty:
emptys_list = []
for i in range(len(list)):
if list[i] == '':
emptys_list.append[i]
return emptys_list
Upvotes: 1