Okay. I have completed my first python program.It has around 1000 lines of code. During development I placed plenty of print statements before running a command
print
You can create a log file and prepare it for writing. Then create a function:
def write_log(*args): line = ' '.join([str(a) for a in args]) log_file.write(line+'\n') print(line)
and then replace your print() function name with write_log()