By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

What does r"""any text""" mean ?

P: n/a
.... as you can find in os.py at line 1 ?

Regards Alexander
Aug 15 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Alexander Eisenhuth wrote:
... as you can find in os.py at line 1 ?
Please don't split your request between subject and body.

String literals enclosed in triple quotes are multiline strings.
String literals prefixed by "r" are raw strings.

http://docs.python.org/ref/strings.html

Regards,
Björn

--
BOFH excuse #71:

The file system is full of it

Aug 15 '07 #2

P: n/a
Hi Alexander,

Alexander Eisenhuth wrote:
... as you can find in os.py at line 1 ?
This is a raw string. Raw strings don't interpret the escape sequences.
Try this:
>>print 'a\nb\tc'
a
b c
>>print r'a\nb\tc'
a\nb\tc

You needn't use the raw string for printing the backslashes. You can
escape them like this:
>>print 'a\\nb\\tc'
a\nb\tc

Regards Alexander
Regards,
Claudio
Aug 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.