How do i use the "\r" or carriage return in python? Can somebody give me an example?
it replaces the current line print foo print bar \r result: bar
Pedantically, when you're outputting HTML from a script you must output a Content-type line. The w3 spec actually requires a carriage return/linefeed ( ala Microsoft ). print "Content-type: text/html\r\n" I've never had a problem outputting just a linefeed. But hey, it was a useful example to answer your question!
P0sitr0n i tried to use it like that in python, but it didnt work :(
There are two places that I know of that still use carriage returns: inside GUIs on Macs, and in combination with linefeeds (CR/LF) in Windows. If you use a carriage return in Unix, and OSX's Unix parts, it will show as "^M".
Join our real-time social learning platform and learn together with your friends!