I have a file with this format:
- Frank,456,768,987
- Mike,123,456,798
And I'm using this code:
name = input()
age = float(input())
ident = float(input())
phone = float(input())
f = open("Test.txt","r")
lines = f.readlines()
f.close()
f = open("test.txt", "w")
data = [name, age, ident, phone]
for line in lines:
if line!= data:
f.write(line)
So, if the list with the inputs equals a line, that line must be removed. Why is this code not working? The files becomes empty.