by rupe

How do I check for the existence of a file in Python?

Import the module os.path, and call os.path.isfile("filename"). This call will return true if the file exists, and false if it doesn't.

 


 
Read more of   The Yak's Frequently Questioned Answers   (mod.2008-11-08)

433.   My boss has developers that use SOAP? How can I help them debug their lame web2.0 non-sense? (Or how can i search inside a given http session for a string using tethereal?)   [jake/2006-05-24]
426.   what is pair programming or what is therapy programming?   [jake/2005-08-26]
351.   How can I setup netware services / mount netware servers in linux?   [jake/2003-02-25]
331.   how do i convert my gaim buddy list to a centericq buddy list?   [jesse/2002-10-16]
315.   How the do you crack (802.11b) WEP keys in linux? (and other havoc)   [jake/2003-01-07]
237.   how do i setup lm_sensors on an abit vp6 mobo?   [jesse/2001-07-08]
212.   Where can you get free juice / ice cream in SFO, April 2001?   [rupe/2001-04-17]
106.   What is Wax?   [jamison/2000-07-03]
97.   Where can I find WAP/WML resources on the net?   [rupe/2000-06-06]
95.   What do the * and ** and *** mean by a FQA number?   [strick/2000-05-14]
92.   How many characters wide is the display on a Nokia 5190?   [rupe/2000-05-10]
65.   Where can I get help with my Physics homework?   [strick/2000-02-22]
56.   Hows do i make bogus IDENTD   [ross/2000-02-11] ( jesse/2000-11-15 strick/2000-10-30 )
39.   Can we get a peek at CRPL?   [strick/2000-02-01]
38.   What did <Andrigaar> and <|PenZerg|> say to the HUMANS in #yak ?   [strick/2000-02-01]