opening sites with PYTHON

"webbrowser" is a module in python which allows to display web-based documents to users.

Installation:

"pip install webbrowser"

Functions:
Here are some of the functions of webbrowser module:

* webbrowser.open(url) - to open the given url


* webbrowser.open_new(url) - to open the given url in a new window


* webbrowser.open_new_tab(url) - to open the given url in a new tab


* webbrowser.get(browserName) - to open the given url in a specific browser(chrome, Firefox, etc)

1.webbrowser.open(url)


This function is used to open the given url in any browser.

Syntax:

1. import webbrowser
2. webbrowser.open("https://pyiseasy.blogspot.com")

2.webbrowser.open_new(url)


This function is used to open the given url in a new window.

Syntax:

1. import webbrowser
2. webbrowser.open_new("https://pyiseasy.blogspot.com")

3.webbrowser.open_new_tab(url)


This function is used to open the given url in a new window.

Syntax:

1. import webbrowser
2. webbrowser.open_new_tab("https://pyiseasy.blogspot.com")

4.webbrowser.get(browserName)


This function is used to open the given url in the specified web browser.

Syntax:

1. import webbrowser
2. browser = webbrowser.get("firefox")
3. browser.open("https://pyiseasy.blogspot.com")

 

@projectsofcode on Instagram

Comments

Popular posts from this blog

HangMan game in PYTHON

Tic-Tac-Toe (multiplayer) using pthon

Projects to consider as a bigener in PYTHON