os.DirEntry.is_symlink()

is_symlink()

Return True if this entry is a symbolic link (even if broken); return False if the entry points to a directory or any kind of file, or if it doesn’t exist anymore.

The result is cached on the DirEntry object. Call os.path.islink() to fetch up-to-date information.

On the first, uncached call, no system call is required in most cases. Specifically, neither Windows or Unix require a system call, except on certain Unix file systems, such as network file systems, that return dirent.d_type == DT_UNKNOWN.

This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.

doc_python
2016-10-07 17:38:47
Comments
Leave a Comment

Please login to continue.