error in os.chdir

Karsten Hilbert Karsten.Hilbert at gmx.net
Sat Jun 30 11:15:59 EDT 2018


On Sat, Jun 30, 2018 at 07:34:46AM -0700, Sharan Basappa wrote:

> sorry. I mean why my code worked in one case but did not in the other one.
> 
> This worked - os.chdir('D:\Projects\Initiatives\machine learning\programs') 
> 
> This did not work - os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion')
> 
> only difference is, I added an additional directory in the problematic case.

The answer lies in the (inadvertant) use of escaping.

Which is the very reason _why_ forward slashes were favoured
over backward ones.

Karsten
-- 
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



More information about the Python-list mailing list