How to open a website in google chrome using webbrowser module

I am trying to open a website from python in google chrome, but when I run this code -

import webbrowser'')

It opens Youtube in edge browser. Then I tried to change the default browser, but it still didn't work, so I ran this code:

import webbrowser
webbrowser.get('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s').open('')

But this code didn't give any output. So how can I open a website in google chrome using python.

1 answer

  • answered 2022-05-04 11:11 arya sianati

    Try this:

    import webbrowser 
    url = ""

    I use instead of and it will works :)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum