Write a python function Split a given file path into filename and parent directory


Topic: Write a python function Split a given file path into filename and parent directory

Solution

def split_filename(input_file_name):
    if( isinstance(input_file_name,str) ==False ):
        raise TypeError
    tokens = input_file_name.split("/")
    return "/".join(tokens[:-1]),tokens[-1]



List all Python Programs