I'm trying to delete a row and update the changes in the CSV file. I used the following code to write the changes into the file. Each time I run this code, it inserts empty rows alternatively.
with open(self.__fileName, 'w') as writeFile:
writer = csv.writer(writeFile)
writer.writerows(file)
Here variable file
is the updated data after deleting the row. The delete function works fine. I checked it with a print statement.
If I delete Row 2, my file should look like the following:
But I delete and run this code, my looks like the following: