YouTip LogoYouTip

Os Symlink

# Python2.x Python os.symlink() Method [![Image 3: Python File Methods](#) Python OS File/Directory Methods](#) * * * ### Overview The os.symlink() method is used to create a symbolic link. A symbolic link is a special type of file that contains a reference to another file or directory, which can point to a different location in the file system. ### Syntax The syntax for the **symlink()** method is as follows: os.symlink(src, dst) ### Parameters * **src** -- The path to the target file or directory for which the symbolic link is to be created. * **dst** -- The path and name of the symbolic link. ### Return Value This method does not return a value. ### Example The following example demonstrates the use of the symlink() method: ## Example #!/usr/bin/python# -*- coding: UTF-8 -*-import os src = '/usr/bin/python'dst = '/tmp/python'# Create a symbolic link os.symlink(src, dst)print"Symlink created successfully" The output of executing the above program is: Symlink created successfully [![Image 4: Python File Methods](#) Python OS File/Directory Methods](#)
← Os TcsetpgrpOs Symlink β†’