[Tutor] Question About chdir()

python-tutor@toddmaynard.com python-tutor at toddmaynard.com
Mon Aug 8 09:18:34 CEST 2005


Let's see if I can get this right.....as I am working on memory and not enough 
sleep.

The 'r' means that using a raw string so the backslashes aren't escaped 
out....

The equivalent without using the 'r' would be: os.chdir('c:\\temp')

--Todd

On Monday 08 August 2005 03:07 am, Don Parris wrote:
> The book, "Programming Python", shows an example of os.chdir() on the
> Windows platform, as follows:
>
> os.chdir(r'c:\temp')
>
> What's the 'r' for?  It didn't seem to make any difference in how
> Python works - at least not on the surface.
>
> Thanks,
> Don


More information about the Tutor mailing list