Is there a way to iterate through a text file using the syntax,
with open(filename,'r') as f:
for line in f:
print f
if the file only contains carriage returns and no newline characters?
So far all I can do is
with open(filename,'r') as f:
for line in f.read().split('\r'):
print f
But the files are sometimes huge. I don’t want to modify the file using dos2unix because another software program needs it in the original format.
You can use Python’s universal newline support for
open()