[Numpy-discussion] Problem with loadtxt

Scott MacDonald scott.p.macdonald@gmail....
Tue Aug 17 19:00:06 CDT 2010


Hi,

I have a text file called 'blah' that contains only the following line:

5399354557888517312,5399354557888517312

I want to load these into a numpy array as unit64's.  The following script
demonstrates my problem:

import numpy as np

with open('blah', 'r') as f:
    x = np.loadtxt(f, delimiter=',', dtype=(np.uint64, np.uint64))

with open('blah', 'r') as f:
    for line in f:
        print line

print x


The output I get is:

5399354557888517312,5399354557888517312

[5399354557888517120 5399354557888517120]


Am I doing something wrong?

Thanks for your help,
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100817/0be3a6b3/attachment.html 


More information about the NumPy-Discussion mailing list