Untitled

Anonymous
python
06/19/2023 9:42 AM
348 B
12
Indexable
#!/usr/bin/python3

import io
import time
import datetime

i = 0

while True:
    with open('log.txt', 'a') as f:    
        now = datetime.datetime.now()
        f.write(f'{now.strftime("%Y-%m-%d %H:%M:%S.%f")}\t{i}\n')
        i += 1
        time.sleep(1)
Editor is loading...