I have a while True loop in a Python script and I would like to write only one line in some files constantly. Next to, I have an other script that read the content (also constantly) of each file. The problem is that when I read, sometime, files are empty beacause the write script is writing in the files.
Here is my write script
while True:
for file in files:
thefile = open(file, "w+")
thefile.write("myLine")
thefile.close()
And my read script
while True:
for file in files:
thefile = open(file, "r")
print thefile.read()
thefile.close()
Have you got an idea ?