c98931e44fe871411bec9576392362e5e95bec0d
.redirects.gollum
| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | +--- |
|
| 2 | +Python/5 Killer Automation Scripts in Python.md: Python/5 Killer Automation Scripts |
|
| 3 | + in Python - Part 1.md |
Python/5 Killer Automation Scripts in Python - Part 1.md
| ... | ... | @@ -0,0 +1,97 @@ |
| 1 | +https://medium.com/codex/5-killer-automation-scripts-in-python-42c273fc37c4 |
|
| 2 | + |
|
| 3 | +# 5 Killer Automation Scripts in Python | by Ishaan Gupta | CodeX | Medium |
|
| 4 | + |
|
| 5 | + |
|
| 6 | +[Ishaan Gupta](https://medium.com/@ishaangupta1201) |
|
| 7 | + |
|
| 8 | + |
|
| 9 | + |
|
| 10 | +[CodeX](https://medium.com/codex) |
|
| 11 | + |
|
| 12 | +Here are some awesome automation scripts that you can use in your Python projects. |
|
| 13 | + |
|
| 14 | +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. |
|
| 15 | + |
|
| 16 | +_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) |
|
| 17 | + |
|
| 18 | +So bookmark it and let’s get started. |
|
| 19 | + |
|
| 20 | +1.) **Convert Images to PDF** |
|
| 21 | +----------------------------- |
|
| 22 | + |
|
| 23 | +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. |
|
| 24 | + |
|
| 25 | +Method 1- |
|
| 26 | + |
|
| 27 | +``` |
|
| 28 | +import os |
|
| 29 | +import img2pdfwith open("out.pdf", "wb") as file: |
|
| 30 | + file.write(img2pdf.convert([i for i in os.listdir('Path of image_Directory') if i.endswith(".jpg")])) |
|
| 31 | +``` |
|
| 32 | + |
|
| 33 | + |
|
| 34 | +Method 2 - |
|
| 35 | + |
|
| 36 | +``` |
|
| 37 | +from fpdf import FPDF |
|
| 38 | +Pdf = FPDF()list_of_images = ["one.jpg", "second.jpg","third.jpg"]for i in list_of_images: |
|
| 39 | + Pdf.add_page() |
|
| 40 | + Pdf.image(i,x,y,w,h) |
|
| 41 | + Pdf.output("out.pdf", "F") |
|
| 42 | +``` |
|
| 43 | + |
|
| 44 | + |
|
| 45 | +**2.)** Convert PDF to CSV |
|
| 46 | +-------------------------- |
|
| 47 | + |
|
| 48 | +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. |
|
| 49 | + |
|
| 50 | +``` |
|
| 51 | +import tabulafilename = input("Enter File Path: ")df = tabula.read_pdf(filename, encoding='utf-8', spreadsheet=True, pages='1') |
|
| 52 | +df.to_csv('out.csv') |
|
| 53 | +``` |
|
| 54 | + |
|
| 55 | + |
|
| 56 | +3.) YT Video Downloader |
|
| 57 | +----------------------- |
|
| 58 | + |
|
| 59 | +A simple automation script to download Youtube videos. No need of any websites or apps, just use the below code to download any video. |
|
| 60 | + |
|
| 61 | +``` |
|
| 62 | +import pytubelink = input('Enter The Youtube Video URL') |
|
| 63 | +dn = pytube.Youtube(link) |
|
| 64 | +dn.streams.first().download() |
|
| 65 | +print('Your Video Has Been Downloaded', link) |
|
| 66 | +``` |
|
| 67 | + |
|
| 68 | + |
|
| 69 | +4.) InstaDpViewer |
|
| 70 | +----------------- |
|
| 71 | + |
|
| 72 | +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. |
|
| 73 | + |
|
| 74 | +``` |
|
| 75 | +import instaloaderil = instaloader.Instaloader() |
|
| 76 | +username = input("Enter Insta username ") |
|
| 77 | +il.download_profile(username , profile_pic_only=True) |
|
| 78 | +print("Your DP is Downloaded") |
|
| 79 | +``` |
|
| 80 | + |
|
| 81 | + |
|
| 82 | +5.) Text to Speech |
|
| 83 | +------------------ |
|
| 84 | + |
|
| 85 | +It uses google Text to Speech API to convert your written Text to AI bot voice. |
|
| 86 | + |
|
| 87 | +``` |
|
| 88 | +from pygame import mixer |
|
| 89 | +from gtts import gTTSdef main(): |
|
| 90 | + tts = gTTS('Like This Article') |
|
| 91 | + tts.save('output.mp3') |
|
| 92 | + mixer.init() |
|
| 93 | + mixer.music.load('output.mp3') |
|
| 94 | + mixer.music.play() |
|
| 95 | +if __name__ == "__main__": |
|
| 96 | + main() |
|
| 97 | +``` |
Python/5 Killer Automation Scripts in Python.md
| ... | ... | @@ -1,97 +0,0 @@ |
| 1 | -https://medium.com/codex/5-killer-automation-scripts-in-python-42c273fc37c4 |
|
| 2 | - |
|
| 3 | -# 5 Killer Automation Scripts in Python | by Ishaan Gupta | CodeX | Medium |
|
| 4 | - |
|
| 5 | - |
|
| 6 | -[Ishaan Gupta](https://medium.com/@ishaangupta1201) |
|
| 7 | - |
|
| 8 | - |
|
| 9 | - |
|
| 10 | -[CodeX](https://medium.com/codex) |
|
| 11 | - |
|
| 12 | -Here are some awesome automation scripts that you can use in your Python projects. |
|
| 13 | - |
|
| 14 | -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. |
|
| 15 | - |
|
| 16 | -_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) |
|
| 17 | - |
|
| 18 | -So bookmark it and let’s get started. |
|
| 19 | - |
|
| 20 | -1.) **Convert Images to PDF** |
|
| 21 | ------------------------------ |
|
| 22 | - |
|
| 23 | -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. |
|
| 24 | - |
|
| 25 | -Method 1- |
|
| 26 | - |
|
| 27 | -``` |
|
| 28 | -import os |
|
| 29 | -import img2pdfwith open("out.pdf", "wb") as file: |
|
| 30 | - file.write(img2pdf.convert([i for i in os.listdir('Path of image_Directory') if i.endswith(".jpg")])) |
|
| 31 | -``` |
|
| 32 | - |
|
| 33 | - |
|
| 34 | -Method 2 - |
|
| 35 | - |
|
| 36 | -``` |
|
| 37 | -from fpdf import FPDF |
|
| 38 | -Pdf = FPDF()list_of_images = ["one.jpg", "second.jpg","third.jpg"]for i in list_of_images: |
|
| 39 | - Pdf.add_page() |
|
| 40 | - Pdf.image(i,x,y,w,h) |
|
| 41 | - Pdf.output("out.pdf", "F") |
|
| 42 | -``` |
|
| 43 | - |
|
| 44 | - |
|
| 45 | -**2.)** Convert PDF to CSV |
|
| 46 | --------------------------- |
|
| 47 | - |
|
| 48 | -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. |
|
| 49 | - |
|
| 50 | -``` |
|
| 51 | -import tabulafilename = input("Enter File Path: ")df = tabula.read_pdf(filename, encoding='utf-8', spreadsheet=True, pages='1') |
|
| 52 | -df.to_csv('out.csv') |
|
| 53 | -``` |
|
| 54 | - |
|
| 55 | - |
|
| 56 | -3.) YT Video Downloader |
|
| 57 | ------------------------ |
|
| 58 | - |
|
| 59 | -A simple automation script to download Youtube videos. No need of any websites or apps, just use the below code to download any video. |
|
| 60 | - |
|
| 61 | -``` |
|
| 62 | -import pytubelink = input('Enter The Youtube Video URL') |
|
| 63 | -dn = pytube.Youtube(link) |
|
| 64 | -dn.streams.first().download() |
|
| 65 | -print('Your Video Has Been Downloaded', link) |
|
| 66 | -``` |
|
| 67 | - |
|
| 68 | - |
|
| 69 | -4.) InstaDpViewer |
|
| 70 | ------------------ |
|
| 71 | - |
|
| 72 | -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. |
|
| 73 | - |
|
| 74 | -``` |
|
| 75 | -import instaloaderil = instaloader.Instaloader() |
|
| 76 | -username = input("Enter Insta username ") |
|
| 77 | -il.download_profile(username , profile_pic_only=True) |
|
| 78 | -print("Your DP is Downloaded") |
|
| 79 | -``` |
|
| 80 | - |
|
| 81 | - |
|
| 82 | -5.) Text to Speech |
|
| 83 | ------------------- |
|
| 84 | - |
|
| 85 | -It uses google Text to Speech API to convert your written Text to AI bot voice. |
|
| 86 | - |
|
| 87 | -``` |
|
| 88 | -from pygame import mixer |
|
| 89 | -from gtts import gTTSdef main(): |
|
| 90 | - tts = gTTS('Like This Article') |
|
| 91 | - tts.save('output.mp3') |
|
| 92 | - mixer.init() |
|
| 93 | - mixer.music.load('output.mp3') |
|
| 94 | - mixer.music.play() |
|
| 95 | -if __name__ == "__main__": |
|
| 96 | - main() |
|
| 97 | -``` |