SubhanUllah Posted October 31, 2022 Report 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)
gulshan212 Posted December 21, 2022 Report 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.
Recommended Posts