[Numpy-discussion] array 2 string

Chris Colbert sccolbert@gmail....
Tue Mar 10 11:35:47 CDT 2009


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 <markbak@gmail.com> 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 is
> written with savetxt, but I cannot get it to store in a variable)
> 1 2 3
> 4 5 6
>
> Thanks, Mark
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090310/13f0bf54/attachment.html 


More information about the Numpy-discussion mailing list