dirname
dirname(path)Get the root directory of a file or folder
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| path | Union[str, List[str]] | Path to the file or a list of paths to files | required |
Returns
| Name | Type | Description |
|---|---|---|
| Union[str, List[str]] | the directory of the file or a list of directories of the files in case path is a list |
Examples
>>> from rlike import *
>>> x = dirname('/home/xyz/mydata.pickle')
>>> x
'/home/xyz'
>>> x = dirname(['/home/xyz/mydata.pickle', '/home/xyz/mydata2.pickle'])
>>> x
['/home/xyz', '/home/xyz']
>>> x = tempfile()
>>> d = dirname(x)