(file_path, force_file=False, force_folder=False)
return file_path, None
Remove the last item from a path if it is a file.
    Returns a tuple of the folder path, and file name if set or None.
    
    As a file or folder may be in the format "/.file" or "/.folder",
    if it doesn't already exist, you may set force_file or force_folder.
Remove the last item from a path if it is a file.
    Returns a tuple of the folder path, and file name if set or None.
    
    As a file or folder may be in the format "/.file" or "/.folder",
    if it doesn't already exist, you may set force_file or force_folder.
Remove the last item from a path if it is a file . Returns a tuple of the folder path and file name if set or None . As a file or folder may be in the format / . file or / . folder if it doesn t already exist you may set force_file or force_folder .
def split_folder_and_file(file_path, force_file=False, force_folder=False):
    """Remove the last item from a path if it is a file.
    Returns a tuple of the folder path, and file name if set or None.
    
    As a file or folder may be in the format "/.file" or "/.folder",
    if it doesn't already exist, you may set force_file or force_folder.
    """
    #If location exists
    if os.path.exists(file_path):
        if os.path.isfile(file_path):
            folders = file_path.replace('\\', '/').split('/')
            return '/'.join(folders[:-1]), folders[-1]
        return file_path, None
    
    #If location doesn't exist
    folders = file_path.replace('\\', '/').split('/')
    if force_file or not force_folder and '.' in folders[-1]:
        return '/'.join(folders[:-1]), folders[-1]
    return file_path, None
def split_folder_and_file ( file_path , force_file = False , force_folder = False ) : #If location exists if os . path . exists ( file_path ) : if os . path . isfile ( file_path ) : folders = file_path . replace ( '\\' , '/' ) . split ( '/' ) return '/' . join ( folders [ : - 1 ] ) , folders [ - 1 ] return file_path , None #If location doesn't exist folders = file_path . replace ( '\\' , '/' ) . split ( '/' ) if force_file or not force_folder and '.' in folders [ - 1 ] : return '/' . join ( folders [ : - 1 ] ) , folders [ - 1 ] return file_path , None