-2

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.

Here's the error.

3
  • Just change your default browser, It should open in chrome. Also take a look at this stackoverflow question Commented Apr 20, 2020 at 7:22
  • Could you send the source code, please? Commented Apr 20, 2020 at 7: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 Commented Apr 20, 2020 at 7:41

3 Answers 3

2

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)
Sign up to request clarification or add additional context in comments.

Comments

0

Set Chrome as your default browser.

Comments

0

#import the given web browser and copy the link

import webbrowser as urlopen

urlopen.open('http://example.com')

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.