> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of globalrev > Sent: Thursday, May 15, 2008 12:04 PM > To: python-list@python.org > Subject: exists=false, but no complaint when i open it!? > > print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet > \trainingsetunzipped\training_set\mv_0000001.txt') > > d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of- > sweden.gif') > d.close() > > exists returns false but when i open it doesnt complain. how come? > > another file that exists returned false for complained when i tried to > open it. > --
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\trainingsetunzi pped\training_set\mv_0000001.txt') ***** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA621 -- http://mail.python.org/mailman/listinfo/python-list