os.path.split()

os.path.split(p)[source]

Split a pathname. Returns tuple “(head, tail)” where “tail” is everything after the final slash. Either part may be empty.