如何在Python中获取logging.FileHandler的文件名?
发布时间:2020-09-16 08:19:33 所属栏目:Python 来源:互联网
导读:logging.FileHandler由文件名构成,那么有什么办法可以从logging.FileHandler对象获取文件名吗? 我尝试过dir(logging.FileHandler),但没有看到任何可能的解决方案. import logging fh = logging.FileHandler(/Users/defuz/test.txt) fh.baseFilena
|
logging.FileHandler由文件名构成,那么有什么办法可以从logging.FileHandler对象获取文件名吗? 我尝试过dir(logging.FileHandler),但没有看到任何可能的解决方案. 解决方法>>> import logging
>>> fh = logging.FileHandler('/Users/defuz/test.txt')
>>> fh.baseFilename
'/Users/defuz/test.txt'
>>> fh.stream.name
'/Users/defuz/test.txt' (编辑:南阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 具有distinct()的Django order_by()过滤器
- python – 在列表中查找项目和重复项
- Python判断字符串与大小写转换
- ValueError:参数必须是密集张量–Python和TensorFlow
- python芹菜max-tasks-per-child-setting默认值
- 如何在django python中用json替换simplejson?
- 低版本中Python除法运算小技巧
- python – 如何在PyCharm中找到所有未使用的类的方法?
- Python:ndarray.flatten(‘F’)有否相反?
- Python – NLP – 将iter(iter(树))转换为列表(树)
