def transposed_lists(list_of_lists, default=None):
if default is None or default is [] or default is tuple():<EOL><INDENT>default = []<EOL><DEDENT>elif default is '<STR_LIT:None>':<EOL><INDENT>default = [None]<EOL><DEDENT>else:<EOL><INDENT>default = [default]<EOL><DEDENT>N = len(list_of_lists)<EOL>Ms = [len(row) for row in list_of_lists]<EOL>M = max(Ms)<EOL>ans = []<EOL>for j in range(M):<EOL><INDENT>ans += [[]]<EOL>for i in range(N):<EOL><INDENT>if j < Ms[i]:<EOL><INDENT>ans[-<NUM_LIT:1>] += [list_of_lists[i][j]]<EOL><DEDENT>else:<EOL><INDENT>ans[-<NUM_LIT:1>] += list(default)<EOL><DEDENT><DEDENT><DEDENT>return ans<EOL>
Like `numpy.transposed`, but allows uneven row lengths

    Uneven lengths will affect the order of the elements in the rows of the transposed lists

    >>> transposed_lists([[1, 2], [3, 4, 5], [6]])
    [[1, 3, 6], [2, 4], [5]]
    >>> transposed_lists(transposed_lists([[], [1, 2, 3], [4]]))
    [[1, 2, 3], [4]]
    >>> x = transposed_lists([range(4),[4,5]])
    >>> x
    [[0, 4], [1, 5], [2], [3]]
    >>> transposed_lists(x)
    [[0, 1, 2, 3], [4, 5]]