In txt file projections.txt like this
0001|AA|17.12.2017.|20:30|21:00|ponedeljak|For a few dolars more|150|true
0002|BB|19.12.2017.|19:30|21:15|sreda|March on the Drina|300|true
0003|GG|20.12.2017.|18:00|19:00|cetvrtak|A fistful of Dolars|500|true
0004|GG|21.12.2017.|21:15|00:00|petak|The Good, the Bad and the Ugly|350|true
How to change string "true" with "false" (delete) in certain line. For example, if I input 0002, how to change in 2nd line. I tried something like this, but it's not working...
def delete_projection():
with open('projections.txt') as projections:
#projections = open('users.txt', 'r').readlines()
delete = input("Input projection code you want to delete: ")
for i in projections:
projection = i.strip("\n").split("|")
if delete == projection[0]:
projection[8]="false"
#projections.close()
with open('projections.txt', 'w+') as projections:
projections.write("false")
projections.close()