1
no1xsyzy 2018-11-19 16:04:01 +08:00
https://docs.python.org/2/library/types.html?highlight=types%20filetype#types.FileType
> types.FileType > The type of open file objects such as sys.stdout; alias of the built-in file. >>> type(sys.stdout) <class '_io.TextIOWrapper'> |
2
warcraft1236 2018-11-19 16:05:32 +08:00
查了一下,pip install filetype 还是有的,而且文档中给了用法
|
3
chenstack 2018-11-19 17:04:58 +08:00
试了一下,可以用 io.IOBase 判断
from io import IOBase isinstance(r, IOBase) |
4
acone2003 OP 谢谢 chenstack,OK!同时也谢谢楼上两位!
|