调用操作系统以打开URL? [英] Call to operating system to open url?
本文介绍了调用操作系统以打开URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用什么来调用操作系统以在用户默认使用的任何浏览器中打开URL? 不担心跨操作系统的兼容性;如果它可以在linux上运行,那对我来说就足够了!
What can I use to call the OS to open a URL in whatever browser the user has as default? Not worried about cross-OS compatibility; if it works in linux thats enough for me!
推荐答案
以下是如何使用给定的URL打开用户的默认浏览器:
Here is how to open the user's default browser with a given url:
import webbrowser
webbrowser.open(url[, new=0[, autoraise=True]])
此处是有关此功能的文档.它是Python stdlibs的一部分:
Here is the documentation about this functionality. It's part of Python's stdlibs:
http://docs.python.org/library/webbrowser.html
我已经在Linux Ubuntu 10.10上成功测试了此功能.
I have tested this successfully on Linux, Ubuntu 10.10.
这篇关于调用操作系统以打开URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文