My text has student data in the form of 1234:zakasi:2:1:3 (student id ,name , sem ,yrs , courses)
I wanted to first check if the student id is in the file and then delete the entire line the id is in if it is
infile = open("students.dat","r")
f = infile.readlines()
id = input('enter your id:')
new_list = []
for line in f:
for item in line.split(':'):
new_list.append(item)
if id in new_list[0]:
# delete the line its found in