python get file path without file name code example
Example: get path to file without filename python
import os
filepath = '/a/path/to/my/file.txt'
os.path.dirname(filepath)
# Yields '/a/path/to/my'
import os
filepath = '/a/path/to/my/file.txt'
os.path.dirname(filepath)
# Yields '/a/path/to/my'