SubhanUllah Posted October 31, 2022 Report Share Posted October 31, 2022 import datetime While True: my_now = datetime.datetime.now().strftime("%d.%b %Y %H:%M:%S") myfile = open("my_file.txt", "a") myfile.write("Added at {my_now}") myfile.close() sleep (100) Link to comment Share on other sites More sharing options...
gulshan212 Posted December 21, 2022 Report Share Posted December 21, 2022 Use the append mode ('a') to open the file. Compose cursor focuses to the furthest limit of document. Make use of the write() function to append "n" at the end of the file. Utilize the write() function to add the specified line to the file. Link to comment Share on other sites More sharing options...
Recommended Posts