Basic question

Discussion in 'Python' started by WILLIAM SCHMIDT, Feb 13, 2008.

  1. 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('sys')

    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
     
    WILLIAM SCHMIDT, Feb 13, 2008
    #1
    1. Advertising

  2. WILLIAM SCHMIDT

    Chris Guest

    On Feb 13, 2:22 pm, "WILLIAM SCHMIDT" <> wrote:
    > 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('sys')

    >
    > 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.
     
    Chris, Feb 13, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Duenser

    Basic shifting question

    Stefan Duenser, Dec 7, 2004, in forum: VHDL
    Replies:
    4
    Views:
    453
    Stefan Duenser
    Dec 8, 2004
  2. Replies:
    1
    Views:
    592
    Eric Smith
    Jul 8, 2005
  3. Engineer
    Replies:
    6
    Views:
    656
    Jeremy Bowers
    May 1, 2005
  4. Replies:
    0
    Views:
    461
  5. Ark Khasin

    A basic question question about volatile use

    Ark Khasin, Jul 31, 2008, in forum: C Programming
    Replies:
    12
    Views:
    367
    Ark Khasin
    Jul 31, 2008
Loading...

Share This Page