redirect prints to log file

Posted by lakshmipathi on Stack Overflow See other posts from Stack Overflow or by lakshmipathi
Published on 2010-03-25T06:25:21Z Indexed on 2010/03/25 6:33 UTC
Read the original article Hit count: 397

Filed under:
|

Okay. I have completed my first python program.It has around 1000 lines of code. During development I placed plenty of print stmt before running a command using os.system() say something like,

print "running command",cmd

os.system(cmd)

Now I have completed the program.I thought about commenting them but redirecting all these unnecessary print (i can't remove all print stmt- since some provide useful info for user) into a log file will be more useful? Any tricks or tips.

© Stack Overflow or respective owner

Related posts about python

Related posts about logic