📅  最后修改于: 2022-03-11 14:47:15.708000             🧑  作者: Mango
# 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)