[Tutor] How do I open my browser from within a Python program
Simon Brunning
simon at brunningonline.net
Fri Sep 15 11:44:21 CEST 2006
On 9/15/06, Will Shattuck <willshattuck at gmail.com> wrote:
> On 9/14/06, Simon Brunning <simon at brunningonline.net> wrote:
> >
> > To open a web browser from within a python program, you want something like:
> >
> > import webbrowser
> > webbrowser.open('www.google.com')
> >
>
> I learned something tonight :) I only have 5 or 10 minutes here and
> there to do any learning with python. So when I saw this my interest
> was raised. So I started IDLE, and tried it out. It didn't work as
> above so, I looked for the python module to make sure I was typing
> everything correctly. The only thing I missed was that there should
> be double quotes instead of single quotes. Why, I don't know yet as
> I'm not that far, but it kind of makes sense from my dabbling with
> programming over the last 5 years.
>
> import webbrowser
> webbrowser.open("www.google.com")
I think you must have had some other issue. In Python, string literals
can be delimited by either singe or double quotes - the resulting
string is identical. (The difference is that in a single quoted
strung, you can use double quote characters without quoting, and
vice-versa. There's yet more to sting literals that this - raw stings,
triple-quoted strings, unicode strings - see
<http://docs.python.org/ref/strings.html> for details.)
--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/
More information about the Tutor
mailing list