[Tutor] Printing RAW string

Jeremy G Clark jeremy.clark at ucr.edu
Fri Jun 10 23:09:15 CEST 2011


print(repr(s))

_________________________________

How i can print the string in raw...as it is

s="hello world\n"
print s

Output:
helloworld

But i want it to be "hello world\n"

I know it can be done by adding a 'r' prefix but is there any other way because the string will be taken in during input!

Any help appreciated :D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110610/ecf19afb/attachment.html>


More information about the Tutor mailing list