'print' does not
The code does handle/preserve all the cases you mentioned (\r\n, final or no final terminating newline, etc).