How to send a e-mail, search in python interpreter ,search in google and make ASCII art with just 2 lines of code
Hey Guys, Welcome back to another brand new post of Sai Ansul's Blog. As in the last 2 blogs of 2 line code Projects. Where I have showed you How to schedule WhatsApp message using just 2 lines of code and How to watch a YouTube video using python with just 2 lines of code
And so now we will learn How to send a mail, search in python interpreter and search in google with just 2 lines of code
The process of it is very similar though sharing the part 1 and part 2
- Creating a project
- Installing
pywhatkit
- 2 lines of code
Part 1
First of all you need to a python interpreter for this project in your device.
I have here used pycharm by JetBrains, you can use any other also.
Then you have to name the file.
I have named it as 2 LINE CODE
.
Then press create, after that a page would open.
Then select the whole over there with Ctrl+A
and click on Backspace
.
So now you have a empty slate open just like the below image.
Part 2
Then you need to go to your Browser and search for pywhatkit
.
Then after you open the site, you'll see a interface like this,
Then you need to click on pip install pywhatkit
to copy the code.
Then we again need to go to the project created.
And open Terminal
and paste this.
After clicking on that you need to paste the codepip install pywhatkit
.
Like this and press Enter
, it will take 1-2 mins to get downloaded, till that you need to open your
And when it shows the message as shown in the image, then we are good to start.
Now lets proceed towards the part 3 that is to code
Now first we need to write
import pywhatkit
Now this would be divided into further 3 parts:
- How to send a e-mail
- How to search in python interpreter
- How to search in google
- How to make ASCII art
1. How to send a e-mail?
The second line code
pywhatkit.send_mail('your email id', 'password', 'subject', 'message', 'recievers mail id')
And its done! Mail has been sent
2.How to search in google?
The second line code
pywhatkit.search('Question')
You can see the results below.
3. How to search in python interpreter?
The parameters are topic (required) - Topic or title that you want to get information about lines (optional, val=3) - Number of lines that you want to print about it
Some common errors Not returning paragraph - Make sure the topic exists and you are providing specific title
The second line code
pywhatkit.info('What is python?')
You can see the results below.
4. How to make ASCII art
The second line code
pywhatkit.image_to_ascii_art('HASHNODE LOGO.jpg','HASHNODE LOGO.txt')
You need to select one image and then write the proper name of the file and then write its extension and after that again put the name and put the extension as .txt
.
Output:
So this was how to How to send a e-mail, search in python interpreter, search in google and make ASCII art with just 2 lines of code
This is it for today guys. Do comment which one you liked the most.
Stay tuned for some more interesting blogs coming up soon.
If you like my content and want to support my efforts please like๐๐ป, share๐ฒ & subscribe to the newsletter to be get notified whenever I post a new blog.