For example, I\'ve got a file with the following path:
/media/my_mountpoint/path/to/file.txt
I\'ve got the whole path and want to get:
import os def find_mount_point(path): while not os.path.ismount(path): path=os.path.dirname(path) return path