Re: [Numpy-discussion] array 2 string

2009-03-11 Thread Michael McNeil Forbes
On 10 Mar 2009, at 10:33 AM, Michael S. Gilbert wrote: > On Tue, 10 Mar 2009 17:21:23 +0100, Mark Bakker wrote: >> Hello, >> >> I want to convert an array to a string. >> >> I like array2string, but it puts these annoying square brackets >> around >> the array, like >> >> [[1 2 3], >> [3 4 5]]

Re: [Numpy-discussion] array 2 string

2009-03-10 Thread josef . pktd
On Tue, Mar 10, 2009 at 11:37 AM, Pierre GM wrote: > Simplifying the loops from a previous poster: >  >>>  "\n".join((" ".join((str(_) for _ in x)) for x in a)) > - Show quoted text - > or if you want to control the formatting, e.g. print "\n".join(("%-10.6f "*a.shape[1] % tuple(x) for x in a))

Re: [Numpy-discussion] array 2 string

2009-03-10 Thread Pierre GM
Simplifying the loops from a previous poster: >>> "\n".join((" ".join((str(_) for _ in x)) for x in a)) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] array 2 string

2009-03-10 Thread Chris Colbert
a = array() b = str(a).replace('[','').replace(']','') there's probably a better way, but it works. On Tue, Mar 10, 2009 at 12:21 PM, Mark Bakker wrote: > Hello, > > I want to convert an array to a string. > > I like array2string, but it puts these annoying square brackets around > the arr

Re: [Numpy-discussion] array 2 string

2009-03-10 Thread Michael S. Gilbert
On Tue, 10 Mar 2009 17:21:23 +0100, Mark Bakker wrote: > Hello, > > I want to convert an array to a string. > > I like array2string, but it puts these annoying square brackets around > the array, like > > [[1 2 3], > [3 4 5]] > > Anyway we can suppress the square brackets and get (this is what

[Numpy-discussion] array 2 string

2009-03-10 Thread Mark Bakker
Hello, I want to convert an array to a string. I like array2string, but it puts these annoying square brackets around the array, like [[1 2 3], [3 4 5]] Anyway we can suppress the square brackets and get (this is what is written with savetxt, but I cannot get it to store in a variable) 1 2 3 4