使用python替换系统文件的最佳方法是什么?

2024-04-19 15:16:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我开发了一个小工具,用MacPro的一些图片替换Dock上特立独行的垃圾图标:https://github.com/kxxoling/mavericktrash

我曾经os.popon公司()要运行系统命令:

sh = 'sudo cp %s %s' % (os.path.join(source, somefile), os.path.join(TRASH_PATH, somefile))
    os.popen(sh)

有比Python更好的方法吗?你知道吗


Tags: 工具pathhttpsgithubcomossh图片