0

I want to know how to delete an entire row in a csv file when a specific string is entered into python. For example, if the number 8 is entered, the row in the csv file where 8 is the first character is deleted.

Explanations in simple terms are appreciated. Thanks

  • Declare your approach for reading csv files. – amin Nov 14 '16 at 10:24
  • I would do it like this: #1 read current line #2 check if first string equals number 8 #3 skip this line #4 read all other lines #5 write all lines that have been read (which is all but the one with 8) into a new file, or overwrite the existing one You might want to tell us where exactly you need help with. – offeltoffel Nov 14 '16 at 10:39

0 Answers0