Readlines returns non ASCII character

SANKAR . shankarphy at gmail.com
Wed Sep 23 08:47:14 EDT 2015


Hi all,

I am not a expert programmer but I have to extract information from a large
file.
 I used  codecs.open(..) with UTF16 encoding to read this file. It could
read all the lines in the file but returns with the non Ascii characters.
Below are 5 sample lines. How do I avoid having this non Ascii items. Is
there a better way to read this?



Thanks
Sankar


‚  ÿþÿ

2 0 1 5 - 0 8 - 2 8 ÿþÿ1 7 : 2 2 : 0 3 Á       í    0ÿþÿE L E K T A _
E O S _ R T D _ V X 2 ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ
ÿþÿ              ¸

0ÿþÿ ÿþÿM L C X ÿþÿM L C X  Pÿþÿ0 . 0 ÿþÿ0 . 0 ÿþÿ0 . 0 
Pÿþÿ              ÿþÿ              ÿþÿN o n e  Pÿþÿ
ÿþÿ              ÿþÿ0  Pÿþÿ              ÿþÿ              ÿþÿO U T 
Pÿþÿ              ÿþÿ              ÿþÿ0  Pÿþÿ
ÿþÿ              ÿþÿ- 5 . 0  Pÿþÿ              ÿþÿ              ÿþÿ6
0 . 0   Pÿþÿ              ÿþÿ              ÿþÿ0 . 5 2

 Pÿþÿ              ÿþÿ              ÿþÿ6 . 4 9

 Pÿþÿ              ÿþÿ              ÿþÿ2 0 . 0 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150923/b5b89bb6/attachment.html>


More information about the Python-list mailing list