python get current path without file 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'