【发布时间】:2019-07-04 08:54:47
【问题描述】:
我有 python 2.7 代码,它创建了一个内置文件对象,它返回一个文件对象<type 'file'>
file(os.path.join('/tmp/test/', 'config.ini'))
我在 python 3.7 中更改的代码如下,它返回 <class '_io.TextIOWrapper'>
open(os.path.join('/tmp/test/', 'config.ini'))
如何在 python 3 中获取文件对象类型
【问题讨论】:
标签: python-3.x file