Logging

Rather than dumping a bunch of print() statements to screen when trying to debug, have Python log all your info to a file for review later instead.

import logging
logging.basicConfig( filename = "myapp.log", level=logging.DEBUG, format="[%(levelname)s %(asctime)s] %(message)s")
logger = logging.getLogger()

logger.debug("This is a harmless debug message")
logger.info("Enjoy some useful information")
logger.warning("Warning Will Robinson!")
logger.error("Nup, sorry, I'm spitting the dummy now")
logger.critical("Abort! Abort! Abort!")

Credit: Thanks to the Socratica video on Logging in Python, https://www.youtube.com/watch?v=g8nQ90Hk328