(filename)
Return true if file exists and is accessible for reading.

    Should be safer than just testing for existence due to links and
    permissions magic on Unix filesystems.

    @rtype: boolean
Return true if file exists and is accessible for reading.
Return true if file exists and is accessible for reading .
def file_exists(filename):
    """Return true if file exists and is accessible for reading.

    Should be safer than just testing for existence due to links and
    permissions magic on Unix filesystems.

    @rtype: boolean
    """

    try:
        f = open(filename, 'r')
        f.close()
        return True
    except IOError:
        return False
def file_exists ( filename ) : try : f = open ( filename , 'r' ) f . close ( ) return True except IOError : return False