![]() |
how to write messages from command window to log file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: how to write messages from command window to log file (/thread-23368.html) |
how to write messages from command window to log file - SriRajesh - Dec-25-2019 Hi, I want to write every this which is showing while running my python script. I use below code, but its not writing q & b values, but they are printing on the command window. #%% logfile = open("logfile.log", "a") logfile.write("hello") a= 0 b=9 print(a) print(b) logfile.close() RE: how to write messages from command window to log file - ibreeden - Dec-25-2019 print(a, file=logfile)Or else: logfile.write(str(a)) |