chdir questions

Kannan Vijayan kvijayan at peri.csclub.uwaterloo.ca
Sun Feb 6 16:21:54 EST 2000


Alex <alex at somewhere.round.here> wrote:

>> I know this is must be an easy one but how do I use os.chdir?  I have
>> tried many different ways of listing the path but no matter how I type
>> it I get an error.  Most common is either:
>> 
>> >>> os.chdir(C:\temp)
>>   File "<string>", line 1
>>      os.chdir(C:\temp)
>> 		 ^
>>  SyntaxError: invalid syntax

> I don't use windows, so there might be another problem with what you're
> trying to do.  However, one thing that struck me about it is that
> os.chdir is usually passed a string.  E.g. you might want to try
> something like os.chdir('C:\temp').

> Alex.

Actually it would be:
os.chdir('c:\\temp') # need to watch those backslashes

-kannan



More information about the Python-list mailing list