How can i write a function that inputs a filename and a message and stores the new log entry?

  error-handling, file, input, python, spyder

The entry should start with the current time when the entry is made and the message shouldstart on a new line.

This is what i have so far:

text_file = open ("fil.txt", "a")

text_file.write("new file.")

text_file.close()


import datetime

x = datetime.datetime.today()

print(x) 

def log_entry()

Source: Python Questions

LEAVE A COMMENT