我正在尝试将日志记录添加到我的脚本中,并遵循python 日志记录教程
示例代码
Run Code Online (Sandbox Code Playgroud)import logging logging.basicConfig(filename='example.log',level=logging.DEBUG) logging.debug('This message should go to the log file') logging.info('So should this') logging.warning('And this, too')
但是我example.log
在脚本所在的目录中找不到该文件。当我调用os.getcwd()
它时,它返回。也C:\\users\\eda
没有日志。