print("These are the coffees and the quantities")
print(f.read())
time.sleep(1)
text = input("What line number do you want to delete?")
with open("coffee names.txt", "r+") as fp:
lines = fp.readlines()
with open("coffee names.txt", "w") as fp:
for line in lines:
if line.strip("\n") == text:
fp.write(line)
I have tried this, but it does not seem to delete 1 line. It deletes the whole thing and puts what I have typed into the shell into the text file.