python - Strange character in file breaks for loop silently -


i'm parsing file python , loop breaks on character in notepad++ looks this

©sub0 

my loop simple

for line in open('myfile.dat').readlines():     print line       print x     x+=1 

there no error, py file quits.

what should make skip character?

is file binary file? if so, try doing open('myfile.dat', 'rb') open binary. if open text, end-of-file character can cause stop reading prematurely.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -