On 9/27/11 2:14 AM, oc-spam66 wrote:
>> if you want to write to a string, why not use .tostring()?
>
> Because A.tostring() returns the binary data, while I would like the text
> representation.
> More precisely, I would like to use A.tofile(sep="\t").
I see -- I've always thought mingling bina
Ah, I found a workaround: savetxt() can work with a StringIO
-> savetxt(file_buffer, A)
This is only a workaround. I still think A.tofile() should be capable of
writing into a StringIO.
--
O.C.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy
> if you want to write to a string, why not use .tostring()?
Because A.tostring() returns the binary data, while I would like the text
representation.
More precisely, I would like to use A.tofile(sep="\t").
> Yes, this is a known shortcoming of .tofile().
Is it worth filing a bug report ?
--
> On 25.09.2011 18:23, OC wrote:
>> as said in the subject, the following code produces an error. Is it normal ?
>>
>> **
>> A = r_[1]
>> file_buffer = StringIO()
>> A.tofile(file_buffer)
>>
>> IOError: first argument must be a string or open
On 25.09.2011 18:23, OC wrote:
> as said in the subject, the following code produces an error. Is it normal ?
>
> **
> A = r_[1]
> file_buffer = StringIO()
> A.tofile(file_buffer)
>
> IOError: first argument must be a string or open file
> ***
Hello,
as said in the subject, the following code produces an error. Is it normal ?
**
A = r_[1]
file_buffer = StringIO()
A.tofile(file_buffer)
IOError: first argument must be a string or open file
**