如何在Ubuntu上使用Python创建文件快捷方式?

0 投票
1 回答
877 浏览
提问于 2025-04-17 23:44

作为一个更好的定义,如何用Python写出下面这个函数呢?

def create_shortcut(source, dest):
    create a shortcut of file 'source' and put it in 'dest'

1 个回答

3

如果你说的“快捷方式”是指符号链接(symlink),那其实就是这样:

import os

os.symlink(source,dest)

撰写回答