I have encountered a very strange problem with 'txt' file in ubuntu, I have a txt file that when reads from windows with python command open('file.txt','r').readlines()
, it gives \n
of each end of line, but when I read it on ubuntu machines with the same open('file.txt','r').readlines()
, it gives \r\n
endings, what's the problem?(I expected the \n
ending)
==EDIT==
Just to make it clear, because most people link some question like 'what is \r and what is \n'. That's not the problem here.
The problem is as follows:
- You have a file, let's say file.txt
- Read the file (using Python) on windows and it produces
\n
line endings - Read (supposedly) the same file (using Python) on linux and it produces
\r\n
line endings - Isn't it counter-intuitive?