Introduction to the pywhatkit Library - Javatpoint
Introduction to the pywhatkit Library - Javatpoint
Installation of Library
We need to install locally to work with the pywhatkit library
because it will not come pre-installed in Python3. We can install it
using the following command.
Syntax -
Parameters -
Code Snippet
Example -
Explanation -
In the above code snippet, we import the pywhatkit library and use
the sendwhatmsg() function to send a message to a phone
number at a certain hour and minute. The code also uses
exception handling to catch and display any errors that may occur
while sending the message.
We can also send image with the caption as below -
pwk.sendwhats_image("Name", "Media/images.png")
Syntax -
pywhatkit.playonyt("url/topic name")
Parameters -
Code Snippet
Example -
# importing the module
import pywhatkit
except:
Explanation -
In the above code, we import the pywhatkit library and use the
playonyt() function to play a random YouTube video based on the
topic provided as a parameter. It also uses exception handling to
catch and display any errors that may occur while playing the
video, such as a network error.
We can also use it for the google search using the search()
method. It opens our browser and searches for the topic that we
have provided in the code. Let's understand the following example.
Example -
except:
Explanation -
Conclusion
In summary, this tutorial has covered using the PyWhatKit library
in Python to perform automatic WhatsApp messaging. The
example code demonstrated the use of the try-except block to
handle any potential errors that may occur during the execution of
the search function. The tutorial hopes that the reader has learned
about using the PyWhatKit library and is ready to implement it in
their code.
← Prev Next →
Splunk SPSS
Swagger Transact-SQL
Tumblr ReactJS
Regex Reinforcement
Learning
R Programming RxJS
React Native Python Design
Patterns
Keras
Preparation
Aptitude Reasoning
Company
Questions
Trending Technologies
Artificial AWS
Intelligence
Selenium Cloud Computing
Hadoop ReactJS
Blockchain Git
Machine DevOps
Learning
B.Tech / MCA
DAA Operating
System
Computer Compiler Design
Network
Computer Discrete
Organization Mathematics
C Programming C++
Java .Net
Python Programs
Control System Data Mining
Data Warehouse