Basically i have a program running 24/7 and i open, write and append to the file with the program... I'm running program in the loop. At the of the loop it waits for 20seconds and then repeats the loop into infinite.
Problem is, that while i'm running the program and trying to open my file alerts.txt, it will show empty(even though it is not). If i exit the program, alerts.txt file WILL show the content.
How could i solve this. Basically i want to check the file when program is running&also insert into it manually...but it's showing empty.
f = open("alerts.txt", "r")
f.close
#somecode
f = open("alerts.txt", "w")
f.write("")
f.close
f = open("alerts.txt", "a")
#somecode
f.close
Problem is, that while i'm running the program and trying to open my file alerts.txt, it will show empty(even though it is not). If i exit the program, alerts.txt file WILL show the content.
How could i solve this. Basically i want to check the file when program is running&also insert into it manually...but it's showing empty.
f = open("alerts.txt", "r")
f.close
#somecode
f = open("alerts.txt", "w")
f.write("")
f.close
f = open("alerts.txt", "a")
#somecode
f.close



![[Image: 0DvFxnA.gif]](https://i.imgur.com/0DvFxnA.gif)