Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (16.4k points)

According to my, '\r' will move the texts to the left side of the page. But when I tried the following code,

carriage_return = "I will use a carriage\rreturn"

print carriage_return

The output which I received was:

return use a carriage

But I expected:


2 Answers

0 votes
by (26.4k points)

It shows, that you did move to the left side of the line.

But, it just untouched the rest of the line.

The reason is, "return" is 6 in character and even "I will" is 6.

Want to learn more about python? Come and Join: python course
0 votes
by (108k points)

Please be informed that the '\r' will takes the pointer to the beginning of the line. For more information regarding the same do refer to the Python certification course.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 24, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer

Browse Categories