Answers for "python split path at level"

1

python split path at level

import os
path = os.path.normpath(path)
path.split(os.sep)
Posted by: Guest on October-14-2021
0

python split path into list

Head of '/home/User/Desktop/file.txt': /home/User/Desktop
Tail of '/home/User/Desktop/file.txt': file.txt 

Head of '/home/User/Desktop/': /home/User/Desktop
Tail of '/home/User/Desktop/':  

Head of 'file.txt': 
Tail of 'file.txt': file.txt
Posted by: Guest on August-31-2021

Python Answers by Framework

Browse Popular Code Answers by Language