I am trying to write to a text file every 5 seconds from the data that is being created by this code.
import time
x = 0
while x < 60:
x += 1
y = x + 2
print(x,y)
time.sleep(1)
while True:
f = open("outputtest.txt", "a+")
f.write(str(x) + "\n")
time.sleep(5)
What I basically want it to do is print the x value of the script every 5 seconds to a data file
Edit: Data is not being outputted to a file currently and that is what i am trying to figure out how to do.
the output would ideally be 5 10 15 20 etc