How to send a e-mail, search in python interpreter ,search in google and make ASCII art with just 2 lines of code

How to send a e-mail, search in python interpreter ,search in google and make ASCII art with just 2 lines of code

ยท

3 min read

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.

image.png Then you have to name the file. I have named it as 2 LINE CODE.

image.png

Then press create, after that a page would open. image.png

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. image.png

Part 2

Then you need to go to your Browser and search for pywhatkit.

image.png Then after you open the site, you'll see a interface like this,

image.png Then you need to click on pip install pywhatkit to copy the code. image.png

Then we again need to go to the project created. And open Terminal and paste this.

Untitled.png After clicking on that you need to paste the codepip install pywhatkit.

image.png 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. image.png

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:

  1. How to send a e-mail
  2. How to search in python interpreter
  3. How to search in google
  4. 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')

image.png

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?')

image.png 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.

image.png

Output:

image.png 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.

ย