python file exist

http://stackoverflow.com/questions/82831/how-do-i-check-if-a-file-exists-using-python

Check out exists() and isfile() functions of os.path module..

import os
os.path.exists(filename)

>>> from os.path import exists
>>> exists('dog.png')
True
>>> exists('dog.png\n')
False


你可能感兴趣的:(python file exist)