📜  目录名称 python 代码示例

📅  最后修改于: 2022-03-11 14:47:15.708000             🧑  作者: Mango

代码示例1
# Directory name from path of file
import os
file_name = "/home/ubuntu/Project/demo.txt"
dir_name = os.path.dirname(file_name)
print(dir_name)