Python recognizing \r as a line delimiter
问题 I'm using import fileinput in a Python script running on an Ubuntu box. I'm running the script on the command line with something along the lines of python myscript.py firstinputfile.txt secondinputfile.txt and inside myscript.py I am using for line in fileinput.input() to iterate over the lines. The problem I'm running into is that firstinputfile.txt and secondinputfile.txt both use Macintosh ( \r ) line endings, and fileinput.input() does not seem to be recognizing \r as a line delimiter.