Python: How to check if cell in CSV file is empty?
You could use try and except.
for row in csvreader:
try:
#your code for cells which aren't empty
except:
#your code for empty cells
with open('testdata1.csv', 'r') as csvfile:
csvreader = csv.reader(csvfile)
for row in csvreader:
print(row)
if not row[0]:
print("12")
Reference: How do I detect missing fields in a CSV file in a Pythonic way?