I am trying to create a simple AI. I've added some functions. But every time when I try to open links it automatically opens in INTERNET EXPLORER. I wanna open the URL in google chrome. So what I've to do? Please help me.
3 Answers
you can use webbrowser:
import webbrowser
url = 'http://docs.python.org/'
# MacOS
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
# Windows
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
# Linux
chrome_path = '/usr/bin/google-chrome %s'
webbrowser.get(chrome_path).open(url)
Comments
#import the given web browser and copy the link
import webbrowser as urlopen
urlopen.open('http://example.com')
1 Comment
Diego Borba
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
webbrowser