One option could be create a sparse matrix using scipy.sparse.coo_matrix and then convert it to dense:
from scipy.sparse import coo_matrix
lst = ['hello', 'world!!']
idx, idy, val = zip(*((i, j, ord(c)) for i, s in enumerate(lst) for j, c in enumerate(s)))
coo_matrix((val, (idx, idy)), shape=(max(idx)+1, max(idy)+1)).todense()
#matrix([[104, 101, 108, 108, 111, 0, 0],
# [119, 111, 114, 108, 100, 33, 33]])
Or use izip_longest(python2)/zip_longest(python3) from itertools:
from itertools import izip_longest
list(zip(*izip_longest(*map(lambda s: map(ord, s), lst))))
# [(104, 101, 108, 108, 111, None, None), (119, 111, 114, 108, 100, 33, 33)]
This gives a 2d list. You can use fillvalue parameter to fill the Nones:
list(zip(*izip_longest(*map(lambda s: map(ord, s), lst), fillvalue=0)))
# [(104, 101, 108, 108, 111, 0, 0), (119, 111, 114, 108, 100, 33, 33)]
listofstrinstead of an ndarray with one of numpy's string types?dtype=floatwhen all the values fit indtype=uint8, which is much less storage and the values usually convert as needed.