write to file
Sharan Basappa
sharan.basappa at gmail.com
Sat May 5 07:25:50 EDT 2018
In my program, I have print statements for debugging.
However, these are cluttering the display. So, I am trying to save
these to a file but somehow I cant seem to get it correct.
For example, the following are the print statement in my program:
print("target_names\n",target_names)
To print to a file, I have opened the file using - fh = open("ML_PY_2.log","w+")
Beyond this, I see that fh.write has to be used but most of the examples I see only show how strings are saved.
Can I get input how to covert the above print statement to save into the file?
Thanks in advance
More information about the Python-list
mailing list