While making projects, we need some ready-made codes that can help us to solve our daily life problems. This article has 5 Automation Scripts for your Python Projects that will solve your problems.
So bookmark it and let’s get started.
1.) Convert Images to PDF
If you had a lot of images and looking for converting them into a single Pdf then this automation script will be handy for you.
with open(“out.pdf”, “wb”) as file:
file.write(img2pdf.convert([i for i in os.listdir(‘Path of image_Directory’) if i.endswith(“.jpg”)]))
Method 2 –
from fpdf import FPDF
Pdf = FPDF()
list_of_images = [“one.jpg”, “second.jpg”,”third.jpg”]
for i in list_of_images:
2.) Convert PDF to CSV
Sometimes we need to convert our PDF data into CSV format, So for that kind of work, this Python script will be handy for you.
filename = input(“Enter File Path: “)
df = tabula.read_pdf(filename, encoding=’utf-8′, spreadsheet=True, pages=’1′)
3.) YT Video Downloader
A simple automation script to download Youtube videos. No need of any websites or apps, just use the below code to download any video.
link = input(‘Enter The Youtube Video URL’)
dn = pytube.Youtube(link)
print(‘Your Video Has Been Downloaded’, link)
This script will download the DP of any Instagram User. It uses module instaloader which takes username as input and downloads the DP as an output.
il = instaloader.Instaloader()
username = input(“Enter Insta username “)
il.download_profile(username , profile_pic_only=True)
print(“Your DP is Downloaded”)
5.) Text to Speech
It uses google Text to Speech API to convert your written Text to AI bot voice.
from pygame import mixer
from gtts import gTTS
tts = gTTS(‘Like This Article’)
if __name__ == “__main__”:
. . .
Well, here are some Awesome Automation Python Scripts that can be helpful for you to build your projects. I hope you find this article helpful and have had learn some new things. Share this article with your Pythoneer Friends.