What is ''r'' in python?

Harish Vishwanath harish.shastry at gmail.com
Wed Jan 7 07:28:09 CET 2009


Hello,

I accidentally did this in the shell.

>>> ''r''
''
>>> ''r'' == ''
True
>>> ''r'' == ""
True

That is <singlequote singlequote r singlequote singlequote>. However if I
try ->

>>> ''c''
  File "<stdin>", line 1
    ''c''
      ^
SyntaxError: invalid syntax
>>> ''z''
  File "<stdin>", line 1
    ''z''
      ^
SyntaxError: invalid syntax

Any other character that way is Invalid Syntax. What is so special about
character r enclose within a pair of single quotes?

Regards,
Harish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090107/4a21c226/attachment.html>


More information about the Python-list mailing list