基础用法

47.1 基础用法

比 print 更专业,可分级别、写文件。

记录日志

import logging
logging.basicConfig(level=logging.INFO)
logging.info('程序启动')
logging.warning('磁盘空间不足')