Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get the containing dir of a file in python

>>> import os
>>> path=os.path.dirname("C:/folder1/folder2/filename.xml")
>>> path
'C:/folder1/folder2'
>>> os.path.basename(path)
'folder2'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dir #file #python
ADD COMMENT
Topic
Name
7+2 =