0
How to read empty stings from CSV cells in below code?
some cells in CSV are empty but below code not reading empty cells and Please any one let me how to read empty cells. https://code.sololearn.com/cdFPDQ2T55We/?ref=app
2 Respostas
+ 4
I think you want to skip them, right? Add
if not line:
continue
after line 5
0
my requirement got fulfilled from below code and Thank you for prompt response.
import csv
csv_file = open("list_users_samples.csv", 'r')
csv_reader = csv.reader(csv_file)
next(csv_reader)
for line in csv_reader:
displayName,sAMAccountName, givenName, description, sn, mail, physicalDeliveryOfficeName ,Initials = line
print(line)
row = [" " if x == "Empty" else x for x in line]
displayName, sAMAccountName, givenName, description, sn, mail, physicalDeliveryOfficeName, Initials = row
print(row)
csv_file.close()