Search code examples
pythonpython-webbrowser

How to pass additional arguments to webbrowser.open


import webbrowser
number = input('Enter text ')
webbrowser.open("https://www.bing.com/search?q=",number)
exit = input('press any key to exit')

Basically I need to search for an input that the user says, but when the user presses enter it only searches for www.bing.com/search?q=


Solution

  • Try doing this:

    webbrowser.open(f"https://www.bing.com/search?q={number}")
    

    Using f-strings, it should work!