Hey so right now I am trying to make a small program that can delete lines based off of number in front of the question. (Just so you don't have to retype the whole question again)
with open("DailyQuestions.txt", "r") as f:
lines = f.readlines()
with open("DailyQuestions.txt", "w") as w:
for line in lines:
Num, A = line.split(" - ")
if not line.startswith(Num):
w.write(line)
Textfile:
1 - Q1
2 - Q2
3 - Q3
4 - Q4
5 - Q5
The problem with this is that it either deletes the whole file or it it expects 2 values (Num, A = line.split(" - ")
). I still can't figure out a way for it to just delete the whole line based on the number infront of it. Any tips or suggestions would help a lot!