[lang-ref] ( path_exists ) ( python )

def test_path_exists():
    # os.path.exists
    assert os.path.exists('/etc/hosts')    is True
    assert os.path.exists('/etc')          is True
    assert os.path.exists('/no/such/file') is False
def test_path_exists_alternative():
    # pathlib.Path.exists
    assert Path('/etc/hosts').exists()    is True
    assert Path('/etc').exists()          is True
    assert Path('/no/such/file').exists() is False