What does ‘\r’ mean? What does it do? I have never seen it before and its giving me headaches. It doesnt seem to have any purpose, since ‘a\ra’ prints as ‘aa’, but its not the same as the string ‘aa’. Im using python 2.6
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s an old control character from typewriters.
It means “carriage return”. In this time, when you pressed “enter”, you were going to the next line, then the carriage went back to the beginning of the line (hence the carriage return).
Then with computers, different OSes made different choices to represent new lines.
On windows, you have “\r\n” (carriage return + new line).
On unices, you have “\n” only (no need to do a carriage return, it was sort of implied by the new line).
On old mac OS, you had “\r” only.
Nowadays, it’s not used except for newlines (or I don’t know other usages).