Since you said you're new to Python, I think you should consider using the logging
module
Look at this link, also the HOWTO can really help.
from the Python docs:
This module defines functions and classes which implement a flexible event logging system for applications and libraries.
You can set the logging module to save all your prints to file and by controlling the logging level you can control the level of messaged.
Example:
import logging
logging.basicConfig(filename='mylog.log',level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
If level=logging.DEBUG
you'll be able to see all messages but by changing to level=logging.INFO
it will save to the file only info and above. try the links they are very useful.