def isemptyfile ( filepath ) : exists = os . path . exists ( safepath ( filepath ) ) if exists : filesize = os . path . getsize ( safepath ( filepath ) ) return filesize == 0 else : return False
python3 check empty file
Determine if the file both exists and isempty
def isemptyfile(filepath):
    """Determine if the file both exists and isempty

    Args:
        filepath (str, path): file path

    Returns:
        bool
    """
    exists = os.path.exists(safepath(filepath))
    if exists:
        filesize = os.path.getsize(safepath(filepath))
        return filesize == 0
    else:
        return False