我想用open()函数打开一个文件。为什么我得到TypeError:“str”对象不可调用?

2024-10-01 02:23:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法打开文件

open('file.txt')

我得到:

Traceback (most recent call last):

  File "<ipython-input-60-f5022126236c>", line 1, in <module>
    open('file.txt')

TypeError: 'str' object is not callable

Tags: 文件intxtmostinputipythonlineopen