'How can I take user input and search it in python?
I'm trying to create a basic personal assistant that will listen to the user,and search things up,compute math, us wikipedia,youtube, and tell random quotes/jokes. For the first step of my project I want to make the program take the users input and search it up. When I was trying to do this, I couldn't get any of the search modules like selenium,or search_google to do what I needed,so i decided to use the python webbrowser module.I'm first testing it by having it take typed input by the user and search it up,but I'm having a problem with that.I have
asker = input("what do you want to search ")
print (asker)
webbrowser.open("https://www.google.com/search?q=(asker)")
However, it will only search the word asker,instead of the user input. How can I fix this?
Solution 1:[1]
webbrowser.open("https://www.google.com/search?q=({})".format(asker))
This should help.
asker is the variable so you cannot put it with string statement like you did above.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
