Is there a cross-platform way to open a file browser in Python?

后端 未结 3 1544
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 07:16

I\'m thinking something along the lines of the webbrowser module, but for file browsers. In Windows I\'d like to open explorer, in GNOME on Linux I want to open nautilus, Konque

3条回答
  •  迷失自我
    2021-02-19 07:26

    I don't know if a ready-to-use module exists, but if there is, it should be on the Activestate's python cookbok (http://code.activestate.com/recipes/langs/python/)

    Also, at least in gnome and on mac os, you can execute "gnome-open http://blah" and "open http://blah" (on mac); both will open the url in user's preferred browser.

    For linux also check freedesktop.org -- a common set of tools covering both Gnome and KDE, that should include something similar.

提交回复
热议问题