I want to get the directory where the file resides. For example the full path is:
fullpath = "/absolute/path/to/file" # something like: os.getdir(fullpath) # if this existed and behaved like I wanted, it would return "/absolute/path/to" I could do it like this:
dir = '/'.join(fullpath.split('/')[:-1]) But the example above relies on specific directory separator and is not really pretty. Is there a better way?