I am trying to create a matrix transpose function for python but I can\'t seem to make it work. Say I have
theArray = [[\'a\',\'b\',\'c\'],[\'d\',\'e\',\'f\
This one will preserve rectangular shape, so that subsequent transposes will get the right result:
import itertools def transpose(list_of_lists): return list(itertools.izip_longest(*list_of_lists,fillvalue=' '))