New member here - Thanks in advance.
I am using Sublime Text, wrote the below. Help me get this to open google!
import webbrowser
webbrowser.open("www.google.com")
I saved this to my desktop as a python file. When I double click it, nothing happens.
Use
Code tags.
(Sep-26-2020, 07:44 PM)jbrick97 Wrote: [ -> ]I saved this to my desktop as a python file. When I double click it, nothing happens.
Do get used to run code from command line and
not trough double click.
Check python version then run file.
# web_b.py
import webbrowser
webbrowser.open("www.google.com")
E:\div_code\new
λ python -V
Python 3.8.3
E:\div_code\new
λ python web_b.py
E:\div_code\new
I use
cmder here same in cmd.
So if no errors the only thing that's happens is that that it open googl.com in your default web-browser.
I guess I'm not sure what you're saying here .. sorry
The bottom line is: you need to tell the Python interpreter to run your program, which you do on the command line.
What operating system are you running? Have you actually installed Python? If not, how do you expect to run Python programs?