☰
Current Page
Main Menu
Home
Home
Editing 5 Killer Automation Scripts in Python - Part 1
Edit
Preview
H1
H2
H3
default
Set your preferred keybinding
default
vim
emacs
markdown
Set this page's format to
AsciiDoc
Creole
Markdown
MediaWiki
Org-mode
Plain Text
RDoc
Textile
Rendering unavailable for
BibTeX
Pod
reStructuredText
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
https://medium.com/codex/5-killer-automation-scripts-in-python-42c273fc37c4 # 5 Killer Automation Scripts in Python | by Ishaan Gupta | CodeX | Medium  [Ishaan Gupta](https://medium.com/@ishaangupta1201)  [CodeX](https://medium.com/codex) Here are some awesome automation scripts that you can use in your Python projects. 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. _Part 2 of this article —_ [_https://medium.com/codex/5-killer-automation-scripts-in-python-part-2-5b5a8995eef8_](https://medium.com/codex/5-killer-automation-scripts-in-python-part-2-5b5a8995eef8) 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. Method 1- ``` import os import img2pdfwith 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: Pdf.add_page() Pdf.image(i,x,y,w,h) Pdf.output("out.pdf", "F") ``` **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. ``` import tabulafilename = input("Enter File Path: ")df = tabula.read_pdf(filename, encoding='utf-8', spreadsheet=True, pages='1') df.to_csv('out.csv') ``` 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. ``` import pytubelink = input('Enter The Youtube Video URL') dn = pytube.Youtube(link) dn.streams.first().download() print('Your Video Has Been Downloaded', link) ``` 4.) InstaDpViewer ----------------- 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. ``` import instaloaderil = 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 gTTSdef main(): tts = gTTS('Like This Article') tts.save('output.mp3') mixer.init() mixer.music.load('output.mp3') mixer.music.play() if __name__ == "__main__": main() ```
Uploading file...
Edit message:
Cancel