Hello, buddies! While playing with Python for a time, I found some quite interesting modules that are considered worthy of sharing with others. So today we're going to see 7 Interesting and Awesome Python libraries(modules;) that are useful too!
This module was created to enable cross-platform copy-pasting in Python which was earlier absent. The pyperclip module has
paste() functions that can send a text to and receive text from your computer’s clipboard. Sending the output of your program to the clipboard will make it easy to paste it on an email, word processor, or some other software.
pip install pyperclip
# Python program to # demonstrate pyperclip module # This will import pyperclip import pyperclip pyperclip.copy("Hello, buddies!") pyperclip.paste() pyperclip.copy("This is an interesting module!") pyperclip.paste()
2. Emoji 😉
Emojis have become a way to express and to enhance simple boring texts. Now, the same gems can be used in Python programs too. Yes, really! You now have the ultimate power to use emojis in your code. For this, emoji module is needed to be installed. Install
pip install emoji
from emoji import emojize print(emojize(":thumbs_up:"))
encode() function can be used from emojis module to convert Unicode to emojis:
import emojis emojified = emojis.encode("There is a :snake: in my boot !") print(emojified)
Now import Wikipedia in Python using Wikipedia module. Use the incessant flow of knowledge with Python for daily needs. Install,
pip install wikipedia
import wikipedia result = wikipedia.page("Marvel") print(result.summary)
Stuck on a coding problem? Wish to visit StackOverflow without leaving the terminal? With howdoi, you can do it! Install,
pip install howdoi
howdoi make trees in Python howdoi commit in git
Ask whatever question you have and it will try it’s best to answer it. From now, you don’t need to open those browsers for a quick search and get those hefty amounts of ads and distractions. Just
The reason this module is here is because this is quite fun! It’s basically an easter egg in Python 3 which is used in Google App Engines. It was added to Google App Engines just as a medium to amuse the users. Install
pip install antigravity
See the magic!
Urllib module is the URL handling module for python. It is used to fetch URLs (Uniform Resource Locators). It uses the urlopen function and is able to fetch URLs using a variety of different protocols.
Urllib is a package that collects several modules for working with URLs, such as:
urllib.requestfor opening and reading.
urllib.robotparserfor parsing robot.txt files --
urllib.parsefor parsing URLs
urllib.errorfor the exceptions raised
pip install urllib
# This will import urlopen # class from urllib module from urllib.request import urlopen page = urlopen("http://geeksforgeeks.org/") print(page.headers)
You can also see the coding of the website by using
# This will import urlopen # class from urllib module from urllib.request import urlopen page=urlopen("http://hashnode.com") # Fetches the code # of the web page content = page.read() print(content)
Yes, a turtle can be imported. Don’t worry it’s not slow. Turtle is a Python module to draw. It has a huge application and a number of methods which you can learn about in here. But with just a few basics, pretty cool stuff can be done. This module comes built-in with Python so there is no need to install it.
# This will import turtle module 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()
So buddies, that's all for now. Happy Coding!