Hi, All,
 
I have found a bug in the loadtxt function. Here is the example. The file name 
is test.txt and contains:
"Thist is test"
3FF 3fE
3Ef 3e8
3Df 3d9
3cF 3c7
 
In the Python 2.5.2, I type:
 
test=loadtxt('test.txt',comments='"',dtype='string',converters={0:lambda 
s:int(s,16)})
 
test will contain
 
array([['102', '3fE'],
       ['100', '3e8'],
       ['991', '3d9'],
       ['975', '3c7']],
      dtype='|S3')
 
The first two values 102 and 100 are wrong. 
 
The reason I am doing this because that I have to process a large amount of 
data from a file. The data is in hex format. This is only way I found that I 
can efficiently convert the hex to decimal. 
 
Anyone has a good solution?
 
Thanks
 
Frank
_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to