def sort_by_type(file_list):
    """
    Sorts a list of files into types.

    :param file_list: List of file paths.
    :return: {extension: [<list of file paths with that extension>]}
    """
    ret_dict = defaultdict(list)
    for filepath in file_list:
        _, ext = os.path.splitext(filepath)
        ret_dict[ext.replace('.', '')].append(filepath)

    return ret_dict
def sort_by_type ( file_list ) : ret_dict = defaultdict ( list ) for filepath in file_list : _ , ext = os . path . splitext ( filepath ) ret_dict [ ext . replace ( '.' , '' ) ] . append ( filepath ) return ret_dict
Sorts a list of files into types.

    :param file_list: List of file paths.
    :return: {extension: [<list of file paths with that extension>]}