我是靠谱客的博主 专注野狼,这篇文章主要介绍linux打开python文件夹_在Linux中打开文件夹窗口的标准方法?,现在分享给大家,希望可以做个参考。

I want to open a folder window, in the appropriate file manager, from within a cross-platform (windows/mac/linux) Python application.

On OSX, I can open a window in the finder with

os.system('open "%s"' % foldername)

and on Windows with

os.startfile(foldername)

What about unix/linux? Is there a standard way to do this or do I have to special case gnome/kde/etc and manually run the appropriate application (nautilus/konqueror/etc)?

This looks like something that could be specified by the freedesktop.org folks (a python module, similar to webbrowser, would also be nice!).

解决方案os.system('xdg-open "%s"' % foldername)

xdg-open can be used for files/urls also

最后

以上就是专注野狼最近收集整理的关于linux打开python文件夹_在Linux中打开文件夹窗口的标准方法?的全部内容,更多相关linux打开python文件夹_在Linux中打开文件夹窗口内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部