【发布时间】:2009-05-22 14:23:39
【问题描述】:
Python 3.0 中的 C API 已更改(弃用)文件对象的许多函数。
在 2.X 之前,您可以使用
PyObject* PyFile_FromString(char *filename, char *mode)
创建一个 Python 文件对象,例如:
PyObject *myFile = PyFile_FromString("test.txt", "r");
...但是这样的功能在 Python 3.0 中不再存在。 与这种调用等效的 Python 3.0 是什么?
【问题讨论】:
标签: python python-3.x python-c-api