def split_fully(path):
parent_path, name = os.path.split(path)
if name == "":
return (parent_path, )
else:
return split_fully(parent_path) + (name, )
split_fully("/home/mike/Python")
If someone is trying to help me who doesn't program in python, the whole purpose of this function is to split up the directory path '/home/mike/Python' into separate components in a tuple IE:
('/', 'home', 'mike', 'Python') <--- output
os.path.split() will divide your path into two parts- parent directory and the last component in the path. It will put the two components in a tuple
IE: ('/home/mike', 'Python')


Sign In
Create Account


Back to top









