日志模块logging
logging.basicConfig(
# 定义等级
level=logging.DEBUG
# 定义输出文件,如果不写则默认打印
filename="output.log"
# 定义输出方式为覆盖,默认追加
filemode = "w"
# 定义输出格式
format="%(acstime)s %(lineno)d %(message)s"
)
logging.debug("haha")
日志对象调用:
logger = logging.getLogger()
fh = logging.FileHandler("test_log")
ch = logging.StreamHandler()
fm = logging.Formatter("%(asctime)s")
fh.setFormatter(fm)
ch.setFormatter(fm)
logger.addHandler(fh)
logger.addHandler(ch)
configparser模块
生成文档模块
hashlib模块
加密相关操作
网友评论