run-script-in-background / your_script.py
nateraw's picture
Update your_script.py
e79a3d0
raw
history blame
390 Bytes
import time
from pathlib import Path
Path('outputs').mkdir(exist_ok=True, parents=True)
# Open the file in append mode
with open("outputs/message.txt", "a") as file:
# Loop 60 times
for i in range(60):
# Append the value of i to the file
file.write(str(i) + "\n")
print(f"Wrote {i}. Sleeping for 1 second")
# Wait for 1 second
time.sleep(1)