5 Interesting Python Modules

ai
In this blog we are going to look 5 interesting python modules that will increase your interest in python language and you will love to use these modules as well.

Let's look at each of them :

1. emoji & emojis module - emoji/emojis module in Python is a library that allows you to use emojis in your Python code. It is particularly useful for adding emojis to text in applications like chatbots, social media automation, or any text-based UI.

As emoji is not a built in module so we need to install it through terminal.
pip install emoji

After installing the "emoji" module we are ready to use it in our python file.

import emoji
import emojis
                                
print(emoji.emojize("I am :thumbs_up:"))
                                
emojified = emojis.encode("Python = :snake:")
print(emojified)


2. howdoi module - The howdoi module in Python is a command-line tool that provides quick answers to programming questions using Stack Overflow. It allows developers to quickly get code snippets and solutions for common programming problems directly from their terminal.

howdoi is not a built in module so we need to install it through terminal.
pip install howdoi

After installing the "howdoi" module we can use it directly from terminal by typing "howdoi" and then the question whose answer we want.

ai


3. wikipedia module - The wikipedia module in Python is a convenient library that allows you to access Wikipedia's content programmatically. You can search for articles, get summaries, and retrieve full article texts directly from Python scripts.

As wikipedia is not a built in module so we need to install it through terminal.
pip install wikipedia

After installing the "wikipedia" module we are ready to use it in our python file.

import wikipedia

print(wikipedia.summary("Mark Zuckerberg"))
                                
print(wikipedia.summary("Mark Zuckerberg", sentences = 2))


4. urllib module - The urllib module in Python is a package that collects several modules for working with URLs. It provides functions for manipulating URLs and fetching data from the web.

urllib module is part of the Python Standard Library, so you don't need to install anything extra to use it.

from urllib.request import urlopen

page = urlopen("https://www.youtube.com/")
print(page.headers)
                                
page2 = urlopen("https://www.youtube.com/")
code = page2.read()
print(code)

5. turtle module - The turtle module in Python is a standard library module used to introduce programming to kids and beginners. It provides a way to draw shapes and patterns using a virtual "turtle" that can be controlled with code. The turtle starts at the center of a window and can move forward, backward, turn left, and turn right.
turtle module is part of the Python Standard Library, so you don't need to install anything extra to use it.

import turtle

myTurtle = turtle.Turtle()
myWin = turtle.Screen()
                                
# Turtle to draw a spiral
def drawSpiral(myTurtle, linelen):
    myTurtle.forward(linelen)
    myTurtle.right(90)
    drawSpiral(myTurtle, linelen-10)
                                
drawSpiral(myTurtle, 80)
myWin.exitonclick()



Watch the below modules video :-