transpose array

Edward A. Falk falk at
Wed Oct 28 00:09:11 CET 2009

In article <cd144a8c-5038-45af-bc1c-509be4702903 at>,
yoshco  <yes.she at> wrote:
>hello everyone
>i have 3 arrays
>and i want to output them to a ascii file like so

Elegant or obfuscated, you be the judge:

  vv = [xVec, yVec, zVec]

  for i in range(len(xVec)):
    print >>f,  ", ".join([x[i] for x in vv])

To be honest, I'd be more likely to do it like this, for readability if
for no other reason:

  for i in range(len(xVec)):
    print >>f, "%f, %f, %f" % (xVec[i], yVec[i], zVec[i])

It might help if we knew what you're *really* trying to do.

	-Ed Falk, falk at

More information about the Python-list mailing list