TypeError: exists() takes 1 positional argument but 2 were given
时间: 2023-10-16 21:05:49 浏览: 56
这个错误提示表示`exists()`函数只需要一个参数,但是却传入了两个参数。这个错误通常是由于传入的参数格式不正确导致的。请检查你的代码,看看是否在调用`exists()`函数时传入了多余的参数。例如,如果你的代码是这样的:`path.exists(file_path, mode='r')`,就会出现这个错误,因为`exists()`函数只需要一个参数,即文件路径,而`mode`参数是多余的。你需要将代码修改为`path.exists(file_path)`,只传入一个参数即可。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)