How can I verify file existence in Python?
Learn to locate files using the os.path.isfile() function in Python.
As a programmer in any language, it won’t be long before you run into a scenario that requires you to verify the existence of specific files. In this tutorial David Blaikie demonstrates how to locate files on your local system using the os.path.isfile() function in Python. David also uncovers the underlying principles of relative and absolute paths, which dictate file discovery in the present working directory. With this knowledge, developers and system administrators with a basic understanding of Python and file structures will be able to discover files quickly and effectively.
David Blaikie is a New York City-based engineer and trainer. He has taught Python, Advanced Python, Perl, and Advanced Perl at New York University’s School of Professional Studies, and has conducted corporate Python training for companies such as Google, Cisco, and Bloomberg, as well as for the U.S. Navy. David has been a release engineer at Google and a software developer for AppNexus, Conde Nast, and several startups. He is also the author of the bestselling O’Reilly book “Python Beyond the Basics: Object-Oriented Programming”. David’s contact information can be found at www.clearpython.com.