os.path
os.path.split()
import os
path = r'C:\Users\Public\book.txt'
(head, tail) = os.path.split(path)
print(head, tail)
# C:\Users\Public book.txt
os.path.splitext()
import os
path = r'C:\Users\Public\book.txt'
(root, ext) = os.path.splitext(path)
print(root, ext)
# C:\Users\Public\book .txt