[Numpy-discussion] using loadtxt to load a text file in to a numpy array
jtaylor.debian at googlemail.com
Wed Jan 15 18:58:25 EST 2014
On 16.01.2014 00:42, Chris Barker wrote:
> bump back to the OP:
> On Wed, Jan 15, 2014 at 2:12 AM, Hedieh Ebrahimi
> <hedieh.ebrahimi at amphos21.com <mailto:hedieh.ebrahimi at amphos21.com>> wrote:
> do either of these work for you?
this gives you bytes not a string, this can only be fixed by adding new
dtypes, see the other thread about that.
same as using python str you get the output originally posted, bytes
representation with duplicated slashes.
This is a bug in loadtxt we need to fix independent of adding new dtypes.
It is also independent of the encoding of the text file, loadtxt doesn't
seem to be able to open other encodings than ascii/utf8 at all and has
no option to tell it what the file is.
as mentioned in my earlier mail this works for ascii:
or of course looping and decoding explicitly.
More information about the NumPy-Discussion