How to read empty stings from CSV cells in below code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Jan 2019, 3:03 PM
Raj Charan
2 Answers
+ 4
I think you want to skip them, right? Add if not line: continue after line 5
13th Jan 2019, 3:28 PM
Anna
Anna - avatar
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()
13th Jan 2019, 4:21 PM
Raj Charan