In this article, you’ll learn how to perform a google search using python
Prerequisites:
Install Necessary Modules:
Open your Prompt and type and run the following command (individually):
pip install pywhatkit
pywhatkit
is a Python library with various helpful features. It is an easy-to-use library that does not require you to do some additional setup.- This module has lots of other cool features as well. Feel free and go-ahead to explore them or if you wish I can write an article about them.
- Now that you are familiar with Google search basics and have acquired basic knowledge of pywhatkit module, we can move forward to the coding section.
Once Installed now we can import it inside our python code.
Source Code:
''' Python Program to Perform Google Search ''' # Import the necessary module! import pywhatkit as kt ############################################### # Method 1: # Display welcome message print("Let's perform Google search!") # Single search item search1 = "Dr Milan Parmar" # Options for multiple search items search2 = "github" search3 = "python4DataScience" search4 = "Happiness" # Call search the method kt.search(search1) ############################################### # Method 2: # Import pywhatkit as kt # kt.search("python4DataScience") # NOTE: If your browser window is open is already running, # it will perform the search in a new tab otherwise will open a new window.
Output:
Let's perform Google search!