【问题标题】:How do I create a folder through python on mac [duplicate]如何在mac上通过python创建文件夹[重复]
【发布时间】:2021-09-21 14:20:31
【问题描述】:

我在互联网上尝试了很多东西,但找不到一个简单的代码来通过 MAC 上的 python 创建文件夹。

【问题讨论】:

标签: python macos


【解决方案1】:
import os

# define the name of the directory to be created
path = "/tmp/om"

try:
    os.mkdir(path)
except OSError:
    print ("Creation of the directory %s failed" % path)
else:
    print ("Successfully created the directory %s " % path)

【讨论】:

    猜你喜欢
    • 2018-12-10
    • 2019-06-21
    • 2014-03-16
    • 1970-01-01
    • 2021-12-26
    • 2011-09-18
    • 1970-01-01
    • 2014-10-17
    • 1970-01-01
    相关资源
    最近更新 更多