-1

Sorry for dragging the entire thread for a millennium and making it way too unsolvable, but I have solved majority of the problems, it's just that I want to fix my delete code but I have no idea where to start with it.

def delete_record():
    with open('StudentDetails.csv', 'wb',) as csvfile:
         csvFileWriter = csv.writer(csvfile)
         a = delete_student_entry.get()
         b = delete_password_entry.get()
         csvFileWriter.writerow([a,b])

I want the program to take the input from the entry box in the window (as I am using Tkinter) and delete an entire row from the input. I will welcome any rewrites of the code as it will be a subroutine for my "delete student" menu (unconventional, I know, but using other forms of calling the subroutine will result in an error in which I had no choice but to do so...)

1 Answers1

0

Do you mean deleting the row, which you get from your Entries, from your CSV file? If so your answer can be found here: using Python for deleting a specific line in a file

Tim
  • 21
  • 4
  • Hi, I have tried using the answers in the thread but I don't think it's what I'm looking for. I'm trying to utilize the csv library, but I have only found out how to add new rows, not delete them... – SpeedySubs Mar 10 '19 at 18:31