import os
directory=input("Directory: ")
if not os.path.exists(directory):
os.mkdir(directory)
os.mkdir(str(directory)+'\steamCMD')
os.mkdir(str(directory)+'\temporary')
我的代码片段。返回此处显示的最后一行的OSError。为什么?做的事情和第五行完全一样,但第五行却很有魅力。 错误:
^{pr2}$相似:Python - os.rename() - OSError: [WinError 123]os.mkdir(path) returns OSError when directory does not exist 但是他对我有不同的错误。有人告诉我为什么会这样吗?在
尝试:
或者
^{pr2}$关于两个},here是文档,here是个好问题。在
\\
或{另外,^{} 是一个不错的选择,因为它在Windows上使用
\\
,而在*nix上使用/
。例如:这在Windows上给出
directory\temporary
,在*nix上给出directory/temporary
。这是一种更清晰、更简单的方法。在相关问题 更多 >
编程相关推荐