Easy Tutorial
❮ Python Interpreter Python Mysql ❯

Python3 os.symlink() Method

Python3 OS File/Directory Methods


Overview

The os.symlink() method is used to create a symbolic link.

Syntax

The syntax for the symlink() method is as follows:

os.symlink(src, dst)

Parameters

Return Value

This method does not return a value.

Example

The following example demonstrates the use of the symlink() method:

#!/usr/bin/python3

import os

src = '/usr/bin/python'
dst = '/tmp/python'

# Create a symbolic link
os.symlink(src, dst)

print("Symbolic link created successfully")

Executing the above program will output:

Symbolic link created successfully

Python3 OS File/Directory Methods

❮ Python Interpreter Python Mysql ❯