# How to create softlink of a file using Python?

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

The method os.symlink(src, dst) creates a symbolic link dst pointing to src. For example, if you have a file called photo.jpg and want to create a softlink/symbolic link to it called my_photo.jpg, then you could simply use:

## Example

>>> import os
>>> os.symlink('photo.jpg', 'my_photo.jpg')

Now if you list the files in that directory, you'll get the my_photo.jpg there as well.

Updated on 13-Dec-2019 09:56:43