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.
Asked
Active
Viewed 3,555 times
-1
-
Just change your default browser, It should open in chrome. Also take a look at this [stackoverflow question](https://stackoverflow.com/questions/47519768/how-do-i-set-the-default-browser-as-chrome-in-visual-studio-code) – AhmerMH Apr 20 '20 at 07:22
-
Could you send the source code, please? – ISD Apr 20 '20 at 07:23
-
It would be helpful if you copy-paste the error as formatted text instead of a link, as it seems people are not even aware you are in fact using `webbrowser` – Tomerikoo Apr 20 '20 at 07:41
2 Answers
1
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)

Nilanka Manoj
- 3,527
- 4
- 17
- 48