Python os.symlink () method
Python OS file / directory methods
Outline
os.symlink () method is used to create a soft link.
grammar
symlink () method syntax is as follows:
os.symlink(src, dst)
parameter
src - the source address.
dst - the destination address.
return value
This method has no return value.
Examples
The following example demonstrates symlink () method of use:
#!/usr/bin/python # -*- coding: UTF-8 -*- import os src = '/usr/bin/python' dst = '/tmp/python' # 创建软链接 os.symlink(src, dst) print "软链接创建成功"
The above program output is:
软链接创建成功