小编the*_*tor的帖子

如何检查对象是否是"文件"的实例?

曾经在Python(2.6)中可以问:

isinstance(f, file)
Run Code Online (Sandbox Code Playgroud)

但是在Python 3.0中file被删除了.

现在检查变量是否为文件的正确方法是什么?What'sNew文档没有提到这个......

python python-3.x

3
推荐指数
2
解决办法
4552
查看次数

标签 统计

python ×1

python-3.x ×1