import logging # logging.disable(logging.CRITICAL) logging.basicConfig(filename="loggingBug.txt",level=logging.DEBUG,format="%(asctime)s-%(levelname)s-%(message)s") def factorial(num): total=1 logging.debug("开始运行:{}".format(num)) for i in range(1,num+1): logging.debug("i={},total={}".format(i,total)) total*=i return total print(factorial(5))
是为了方便我以后查阅,所以注释不是很详细,如果有问题,可以尽情留言私信,我都会回复~
原文地址:https://www.cnblogs.com/lyxcode/p/10919668.html
时间: 2024-10-03 09:00:44