exists=false, but no complaint when i open it!?

Reedick, Andrew jr9445 at ATT.COM
Thu May 15 12:21:16 EDT 2008



> -----Original Message-----
> From: python-list-bounces+jr9445=att.com at python.org [mailto:python-
> list-bounces+jr9445=att.com at python.org] On Behalf Of Reedick, Andrew
> Sent: Thursday, May 15, 2008 12:11 PM
> To: globalrev; python-list at python.org
> Subject: RE: exists=false, but no complaint when i open it!?
> 
> >
> > print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet
> > \trainingsetunzipped\training_set\mv_0000001.txt')
> >
> 
> 
> You're falling victim to string interpolation because of the
> backslashes.  (\n == newline, \N == N).
> 
> Try using a raw string r'filename', instead of 'filename':
> 	print
>
os.path.exists(r'C:\Users\saftarn\Desktop\NetFlixDataSet\trainingsetunz
> i
> pped\training_set\mv_0000001.txt')
> 
> 

Specificially, the \t in '\trainingsetunzipped' and in '\training_set'
were being treated as tab characters.  Ignore my comment about '\N ==
N'.



More information about the Python-list mailing list