I would do import os path = os.path.normpath(path) path.split(os.sep). First normalize the path string into a proper string for the OS. Then os.sep must be ... ... <看更多>
Return the directory name of pathname path. This is the first element of the pair returned by passing path to the function split(). os.path.split(path). Split ... ... <看更多>
Paths cannot contain both a drive letter and a UNC path. Note that this differs from the Python os.path module in that UNC parts are considered ... ... <看更多>