5 Most Useful Scripts in Python

5 Most Useful Scripts in Python


Published at - Nov 25, 2021

5 Most Useful Scripts in Python

5 Most Useful Scripts in Python

A list of Python scripts for converting JSON to CSV, generating passwords, searching for strings, fetching links, and watermarking images.

Made with [canva](https://canva.com)Made with canva

Hello everyone, This is my first post on a useful Python script. I will publish more posts in the future where I will collect important scripts of Python or mini-projects to improve my Python skills.

Table of Content

· 1. Convert JSON to CSV · 2. Python Password Generator · 3. String search from multiple files · 4. Fetch all links from a given webpage · 5. Image Watermark

1. Convert JSON to CSV

This script will convert your JSON data to a CSV file. It takes .json a file as input and provides .csv the file as output.

Installation

pip install json

Python Script (json-to-csv.py)

<iframe src="https://medium.com/media/bc8b75b0d2b32e52d8c534e0ebd16152" frameborder=0></iframe>

JSON File (input.json)

<iframe src="https://medium.com/media/92ea762dd9abc5fd21d4c4776494d10d" frameborder=0></iframe>

Run

python3 json-to-csv.py

2. Python Password Generator

This simple Python project is using random and string package to generate a random string of a given length.

Python script (python-password.py)

<iframe src="https://medium.com/media/ee9c688c9418bae8687654bfd1cde6c5" frameborder=0></iframe>

Run

python3 python-password.py

3. String search from multiple files

Finds a file with the supplied string in the folder of your choosing.

Python script (search-string.py)

<iframe src="https://medium.com/media/06f6f0afe1c98683136155127bfda8b4" frameborder=0></iframe>

Run

python3 search-string.py

4. Fetch all links from a given webpage

This script gets all links from a particular website and saves them as a text file.

Installation

pip install beautifulsoup4 requests

Python script (get-links.py)

<iframe src="https://medium.com/media/8d14a9ee4d3c9abf1a7582cee91ec177" frameborder=0></iframe>

Run

python3 get-links.py

5. Image Watermark

This project will take a photograph and put a watermark of your choice on it.

Installation

pip install Pillow

Python script (watermark.py)

<iframe src="https://medium.com/media/58c693435b8a6972d3d05b003deeadd4" frameborder=0></iframe>

Run

python3 watermark.py [image_path]

Replace [image path] with the image on which you wish to apply a watermark.

Conclusion

I have provided 5 scripts to learn Python. I hope these will help you learn something new. Clap 👏 on this post to learn more posts from this series of posts soon. Learn more python script posts here.

I hope you enjoyed reading this lesson; you can follow me to read more tutorials from me in the future. Thank you for your time.

By becoming a Medium member, you can support me and your other favorite authors. Thanks! 👇 Join Medium with my referral link - Harendra Verma As a Medium member, a portion of your membership fee goes to writers you read, and you get full access to every story…medium.com

More content at plainenglish.io. Sign up for our free weekly newsletter here.





About author

Harendra
Harendra Kanojiya

Hello, I am Harendra Kumar Kanojiya - Owner of this website and a Fullstack web developer. I have expertise in full-stack web development using Angular, PHP, Node JS, Python, Laravel, Codeigniter and, Other web technologies. I also love to write blogs on the latest web technology to keep me and others updated. Thank you for reading the articles.



Follow Us

Follow us on facebook Click Here

Facebook QR
Scan from mobile
Join our telegram channel Click Here
Telegram QR
Scan from mobile