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]]
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))
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
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
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
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