On 23 Dez., 09:33, Yan Cheng CHEOK <ycch...@yahoo.com> wrote:
> Currently, I have the following text file 
> (https://sites.google.com/site/yanchengcheok/Home/TEST.TXT?attredirect...) 
> written by C++ wostringstream.
>

The coding of the file is utf-16le. You should take care
of this coding when you *read* the file, and not when
you display its content.

>>> import io
>>> with io.open('test.txt', 'r', encoding='utf-16le') as f:
...     r = f.readlines()
...
>>> len(r)
94
>>> r[:5]
[u'\n', u'      0.000       1.500       3.000       0.526
   0.527       0.527     0.00036     0.00109     1381.88
 485.07\n', u'    0.000       1.500       3.000       1.084
     1.085       1.086     0.00037     0.00111     1351.86
   978.02\n', u'    0.000       1.500       3.000
1.166       1.167       1.168     0.00043     0.00130
1152.71      897.16\n', u'   -3.000       0.000       3.000
    -0.031      -0.029      -0.025     0.00158     0.00475
   632.17      626.13\n']
>>> # from there, do what you wish with this list...
>>>

jmf
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to