webbrowser

Open a web page using Python
import webbrowser  #You must import this at the top of your code
webbrowser.open("http://www.bbc.co.uk/newsround")

Note if you have a web browser open this page will open in a new tab

Or you can open it by creating the website address as a variable

import webbrowser
link = ("http://www.bbc.co.uk/newsround")
webbrowser.open(link)


Open the web page in a new window
import webbrowser
link = ("http://www.bbc.co.uk/newsround")
webbrowser.open_new(link)   #adding _new opens a new browser


Using a web page in an if else situation
tryagainlink and welldone are links to web pictures
If you get the answer correct it opens one web page.
If you get the answer wrong it opens another web page.
The only problem is the fact that the user has to close the browser to get back to Python.

Which web page menu program


Opening sound media in a web page

Comments