directory name python

Solutions on MaxInterview for directory name python by the best coders in the world

showing results for - "directory name python"
Loris
20 Apr 2016
1# Directory name from path of file
2import os
3file_name = "/home/ubuntu/Project/demo.txt"
4dir_name = os.path.dirname(file_name)
5print(dir_name)