mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
This commit is contained in:
parent
d3f61a2de6
commit
ae882f7984
11 changed files with 57 additions and 4 deletions
|
@ -174,6 +174,17 @@ def exists(path):
|
|||
return True
|
||||
|
||||
|
||||
# Being true for dangling symbolic links is also useful.
|
||||
|
||||
def lexists(path):
|
||||
"""Test whether a path exists. Returns True for broken symbolic links"""
|
||||
try:
|
||||
st = os.lstat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
# Is a path a directory?
|
||||
# This follows symbolic links, so both islink() and isdir() can be true
|
||||
# for the same path.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue