libb.splitall

splitall(path)[source]

Split path into all its components.

Works with both Unix and Windows paths.

Parameters:

path (str) – Path string to split.

Returns:

List of path components.

Return type:

list

Raises:

TypeError – If path is not a string.

Example:

>>> splitall('a/b/c')
['a', 'b', 'c']
>>> splitall('/a/b/c/')
['/', 'a', 'b', 'c', '']
>>> splitall('/')
['/']
>>> splitall('C:')
['C:']
>>> splitall('C:\\')
['C:\\']
>>> splitall('C:\\a')
['C:\\', 'a']
>>> splitall('C:\\a\\')
['C:\\', 'a', '']
>>> splitall('C:\\a\\b')
['C:\\', 'a', 'b']
>>> splitall('a\\\\b')
['a', 'b']