Skip to content
Advertisement

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=

Advertisement

Answer

Try doing this:

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

Using f-strings, it should work!

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement