Python method symlink() creates a symbolic link dst pointing to src.
Following is the syntax for symlink() method:
os.symlink(src, dst)
This method does not return any value:
The following example shows the usage of symlink() method.
#!/usr/bin/python import os src = '/usr/bin/python' dst = '/tmp/python' # This creates a symbolic link on python in tmp directory os.symlink(src, dst) print "symlink created"
Let us compile and run the above program, this will create a symbolic link in /tmp directory which will be as follows:
lrwxrwxrwx. 1 root root 15 Apr 30 03:00 python -> /usr/bin/python
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.