Amazing Python hacks every programmer must know
Python is known for its wide number of predefined libraries, which saves much of our time. In this article, we will learn some amazing python hacks with some rare yet cool libraries. The main purpose of this article is to learn(or automate) a few basic things with the help of python. So, let us begin.
1. Download Youtube videos
We all see some of the useful content on youtube whether it be educational or for entertainment purposes. This platform doesn’t charge us and it’s available free to watch an unlimited wide variety of videos. The only problem arises when we want to download these videos for the future. Here is a cool python library “pytube” which supports downloading.
To install the library :
pip install pytube
Gist code :
2. Automating Whatsapp message
No doubt, Whatsapp has become the most default app for android users. This app enables us to send messages anywhere, sitting in any corner of the world. Besides all its amazing features, Scheduling our messages for a particular time would be the coolest thing. This can be done with python library “pywhatkit”
To install the library :
pip install pywhatkit
Gist code :
3. Google Search with Python
Sometimes we get so much into programming that we feel lazy enough to open the browser and search our queries. But with the amazing python library “google”, we can search our queries by just writing 3 lines of code without manually opening the browser and searching our query on it.
To install the library :
pip install google
Gist code:
4. Downloading Instagram Posts and profile picture
We all come across some wonderful posts on Instagram and want to save them offline on our devices. But the app provides posts to be saved online for later and not offline. This can be done with the amazing python library “instaloader”.
To install the library :
pip install instaloader
Gist code:
5. Extracting audio from the video files
There are certain situations when we have the mp4 file but we only need the audio from it. We struggle enough to get the same audio file, but we fail and unfortunately, we decide to choose the other music file. This problem is solved with the python library “moviepy”, as we can extract the audio from the video files through this.
To install the library :
pip install moviepy
Gist code:
6. URL Shortener
Dealing with long URLs is a hectic task when you have to regularly work with them. There comes the idea of URL Shorteners(such as bit.ly and tinyurl). These services shorten the URL to below 50 characters. We can create our own URL shortener with the help of the python library “pyshorteners”.
To install the library :
Pip install pyshorteners
Gist code:
7. Image to PDF Convertor
Sometimes we have our notes or documents as photographs, and it becomes difficult to study in that manner. We might follow the wrong sequence and things become confusing and annoying. To solve this problem one idea is to collect all the images and then convert them into a pdf file. This can be done with the python library “img2pdf”.
To install the library :
Pip install img2pdf
Gist code:
8. Plagiarism detector
One of the most important factors for dealing with content writing is Plagiarism. It’s not even possible to check the files manually when they are in bundles. There comes the need for the Plagiarism detector tool. We can also create our own plagiarism detector with the help of the python library “difflib”. It can be used to check similarities between two or more files on a device.
Gist code:
9. Language Translator
We live in a world of multilingual people. Therefore to understand each other’s language, we need a language translator, since we cannot learn these many languages. We can create our own language translator with the help of the python library “Translator”.
To install the library :
Pip install translate
Gist code:
10. QR code generator
We see QR(Quick Response) code often in our day-to-day life. A very quick example is payment apps, where QR code saves a lot of user’s time. We can also create our unique QR code for website or profiles with the python library “qrcode”
To install the library :
Pip install qrcode
Gist code:
Conclusion
I guess you would have enjoyed these cool python hacks. Try these techniques, you can even create a GUI app based on these so that you can use it quickly whenever you need it. So, This was all for this article. If you enjoyed the article, do upvote it.
Thanks for reading!
OhNoCrypto
via https://www.ohnocrypto.com
, @KhareemSudlow