Re: transpose array

2009-10-30 Thread Aahz
In article , Rhodri James wrote: > >Surely more Pythonic would be: > >for t in zip(xVec, yVec, zVec): > print >>f, ", ".join(t) Except that you *really* want itertools.izip() if these vectors are likely to be any significant size. -- Aahz (a...@pythoncraft.com) <*> http://w

Re: transpose array

2009-10-28 Thread yoshco
On Oct 28, 4:48 am, alex23 wrote: > On Oct 28, 8:26 am, yoshco wrote: > > > hello everyone > > i have 3 arrays > > xVec=[a1,a2,a3,a4,a5] > > yVec=[b1.b2.b3.b4.b5] > > zVec=[c1,c2,c3,c4,c5] > > > and i want to output them to a ascii file like so > > > a1,b1,c1 > > a2,b2,c2 > > a3,b3,c3 > > ... > >

transpose array

2009-10-28 Thread yoshco
hello everyone i have 3 arrays xVec=[a1,a2,a3,a4,a5] yVec=[b1.b2.b3.b4.b5] zVec=[c1,c2,c3,c4,c5] and i want to output them to a ascii file like so a1,b1,c1 a2,b2,c2 a3,b3,c3 ... now i'm using print >>f, str(xVec).replace('[',' ').replace(']', ' ') print >>f, str(yVec).replace('[',' ').rep

Re: transpose array

2009-10-27 Thread alex23
On Oct 28, 8:26 am, yoshco wrote: > hello everyone > i have 3 arrays > xVec=[a1,a2,a3,a4,a5] > yVec=[b1.b2.b3.b4.b5] > zVec=[c1,c2,c3,c4,c5] > > and i want to output them to a ascii file like so > > a1,b1,c1 > a2,b2,c2 > a3,b3,c3 > ... I'd probably go with something like the following: all_array

Re: transpose array

2009-10-27 Thread Steven D'Aprano
On Tue, 27 Oct 2009 15:26:55 -0700, yoshco wrote: > hello everyone > i have 3 arrays > xVec=[a1,a2,a3,a4,a5] > yVec=[b1.b2.b3.b4.b5] > zVec=[c1,c2,c3,c4,c5] > > and i want to output them to a ascii file like so > > a1,b1,c1 > a2,b2,c2 > a3,b3,c3 > ... f = open('myfile.txt', 'w') for t in zip(xV

Re: transpose array

2009-10-27 Thread Rhodri James
On Tue, 27 Oct 2009 23:09:11 -, Edward A. Falk wrote: In article , yoshco wrote: hello everyone i have 3 arrays xVec=[a1,a2,a3,a4,a5] yVec=[b1.b2.b3.b4.b5] zVec=[c1,c2,c3,c4,c5] and i want to output them to a ascii file like so a1,b1,c1 a2,b2,c2 a3,b3,c3 ... Elegant or obfuscated

Re: transpose array

2009-10-27 Thread Ishwor Gurung
Hi, >> xVec=[a1,a2,a3,a4,a5] >> yVec=[b1.b2.b3.b4.b5] >> zVec=[c1,c2,c3,c4,c5] >> >> and i want to output them to a ascii file like so >> >> a1,b1,c1 >> a2,b2,c2 >> a3,b3,c3 >> ... >> >> now i'm using >> >>    print >>f, str(xVec).replace('[',' ').replace(']', ' ') >>    print >>f, str(yVec).repla

Re: transpose array

2009-10-27 Thread Edward A. Falk
In article , yoshco wrote: >hello everyone >i have 3 arrays >xVec=[a1,a2,a3,a4,a5] >yVec=[b1.b2.b3.b4.b5] >zVec=[c1,c2,c3,c4,c5] > >and i want to output them to a ascii file like so > >a1,b1,c1 >a2,b2,c2 >a3,b3,c3 >... Elegant or obfuscated, you be the judge: vv = [xVec, yVec, zVec] for i

Re: transpose array

2009-10-27 Thread Peter Otten
yoshco wrote: > hello everyone > i have 3 arrays > xVec=[a1,a2,a3,a4,a5] > yVec=[b1.b2.b3.b4.b5] > zVec=[c1,c2,c3,c4,c5] > > and i want to output them to a ascii file like so > > a1,b1,c1 > a2,b2,c2 > a3,b3,c3 > ... > > now i'm using > >print >>f, str(xVec).replace('[',' ').replace(']', '