i,m reading some lines from a file and i’m checking whether each line has windows type of CRLF or not. If either ‘\n’ or ‘\r’ is absent in any line, it has to report an error. I tried with the below code, even if the line doesnt have ‘\r’, it is not reporting any error
Open_file = open(File_Name,'r').readlines()
while Loop_Counter!= Last_Line:
Line_Read = Open_file[Loop_Counter]
if('\r\n' in Line_Read):
pass
else:
print Loop_Counter
Thank you
try this
you have to open file in binary mode