Computer Science, asked by sachin1234asdf, 10 months ago

write a python program to open any website by entering the url of that website?

Answers

Answered by joeljohn075
0

Answer:

Here's the code:

Explanation:

import webbrowser   #imports webbrowser module

chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'  

website = input("Enter url: ")

webbrowser.get(chrome_path).open(website)

Code Explanation:

The code is very easy to understand... in the first line, the module to open websites is imported. In the second line, the location of where your chrome browser is located is specified. For most computers, this location will be the same(windows systems). In the next line, the program asks user to enter the url. Note that the complete url must be entered. After that, the webbrowser module opens the website. Also note that this works only in google chrome.

Don't forget to like if you found this useful.

Similar questions