我想用python来创建一个新文件夹,如果该文件夹已经存在不会给我一个例外。因此我运行代码:Makedirs错误意外的关键字参数'exists_ok'
import os
os.makedirs('test', exist_ok=True)
然后我收到错误
Traceback (most recent call last):
File "C:\...\testing.py", line 3, in <module>
os.makedirs('test', exist_ok=True)
TypeError: makedirs() got an unexpected keyword argument 'exist_ok'
我真的不明白这意味着什么,或者为什么它不工作?
我真的不能找到那么多的文件上exist_ok除了它是新的下面
https://docs.python.org/3/library/os.html?highlight=makedirs#os.makedirs
感谢
到Python 3.2
你确定你正在使用Python 3.x的运行脚本? – Selcuk