Basic question

W

WILLIAM SCHMIDT

In several places in the Python documentation I have run across an extra "r" that I can not explain:


*****************************
In sys.path after the open bracket:
sys.path = [r'd:\temp']

In the on line help in the DATA section (towards the end):
Help on built-in module sys:

~~~~ truncated ~~~~

DATA
exec_prefix = r'C:\Python25'
executable = r'C:\Python25\pythonw.exe'
path = [r'C:\Python25\Lib\idlelib', r'C:\Python25\python25.zip', r'C:\...
prefix = r'C:\Python25'
version = '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bi...
*****************************

Can someone explain what that "r" is doing and where I would find it in the documentation?

Thank you in advance for your assistance.

William T. Schmidt
 
C

Chris

In several places in the Python documentation I have run across an extra "r" that I can not explain:

*****************************
In sys.path after the open bracket:
sys.path = [r'd:\temp']

In the on line help in the DATA section (towards the end):

Help on built-in module sys:

~~~~ truncated ~~~~

DATA
exec_prefix = r'C:\Python25'
executable = r'C:\Python25\pythonw.exe'
path = [r'C:\Python25\Lib\idlelib', r'C:\Python25\python25.zip', r'C:\...
prefix = r'C:\Python25'
version = '2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bi...
*****************************

Can someone explain what that "r" is doing and where I would find it in the documentation?

Thank you in advance for your assistance.

William T. Schmidt

It means it is a raw string, useful so you do not need to escape
special characters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top