Oct-13-2019, 07:07 AM
Use the flush() method. Also your use of writelines is not correct
import time, datetime ctr=100 opn = open("paillasse/ecrlog.txt","a+") while(ctr): opn.write(str(ctr) + '\n') opn.flush() ctr=ctr-1 time.sleep(1) print(ctr) opn.close() #close file