Understand what symbolic link in Python is

  • symbolic link

    Soft connection is essentially a Unix concept, not a Python concept.

  • link in Unix

    A link in UNIX is a pointer to a file.

    Like pointers in any programming languages, links in UNIX are pointers pointing to a file or a directory.

    Creating links is a kind of shortcuts to access a file.

    There are two types of links:

    1. Soft link or Symbolic links
    2. Hard Links

    These links behave differently when the source of the link is moved or removed.

    Symbolic links are not updated(they merely contain a string which is the pathname of its target); hard links always refer to the source, even if moved or removed.

  • Python related functions

    os.readlink(path) : returns a string representing the path to which the symbolic link points.

    os.symlink(src, dst) : create symbolic link.

  • References

  1. Soft and Hard links in Unix/Linux

Guess you like

Origin blog.csdn.net/The_Time_Runner/article/details/109277045