Library of small Python custom functions

A quick Python function to browse a folder: Write your main code as a sample below, A sample output of the code is, How does the function work? The Python function browse_open_folder_directory does not take any arguments, but it opens a dialog box using the filedialog module of the tkinter library. The dialog box allows […]

Read More

Remove empty and duplicates lines in a file

The objective of this Python function is to read the contents of a text file, remove any empty lines and any duplicate lines, and then overwrite the file with the updated content that no longer contains empty lines or duplicate lines. Ready-to-use Python function to empty or blank lines and duplicate lines in a file: […]

Read More

Remove empty lines in a text file

The objective of this Python function is to read the contents of a file, remove any empty lines, and then overwrite the file with the updated content that no longer contains empty lines. Ready-to-use Python function to remove empty lines from a text file: Write your main code as a sample below, The output of […]

Read More

How to Webscrap by Python Function?

Install the following module(s) if you haven’t installed them already: Ready-to-use Python function to scrap content of a website: Write your main code as a sample below, The output of the code is, This is a Python function that performs web scraping on a specified URL using the Requests library. Here’s how the function works: […]

Read More

A Progress bar with status in percentage

Install the following module(s) if you haven’t installed them already: Ready-to-use Python function to display the progress bar along with the status text in percentage: Write your main code as a sample below, The output of the code is, This is a Python function that creates a progress bar with a status label in a […]

Read More

Plot data in pie (or) bar charts using Python ready-to-use function?

Install the following module(s) if you haven’t installed them already: Ready-to-use Python function to plot data in a Pie (or) Bar chart: Write your main code as a sample below, The output of the code is, This code is a Python function to plot a chart using the Matplotlib library. The function takes in the […]

Read More

Convert an image size using Python ready-to-use function

Install the following modules if you haven’t installed them already: Ready to use Python function to convert or scale or re-size an image using Pytho ready-to-use function: Write your main code as a sample below, The output of the code is, This code is written in Python and uses the Pillow library to resize an […]

Read More

Find a Word in a Text file using Python ready-to-use function

Ready to use Python function to find a word in a text file: Write your main code as a sample below, and save a text file named ‘test python.txt’ in the same directory by the inclusion of the word ‘request’ in the text file. The output of the code is, This code defines a function […]

Read More

Export List Data to an Excel file with Python ready-to-use function

Install the following modules if you haven’t installed them already: Ready to use Python function to export data in List format to an excel file: Write your main code as a sample below, The output of the code is, The export_to_excel function is used to export data from a list of lists (ImpData) to an […]

Read More

How to convert bytes to KB, MB and GB with Python ready-to-use function?

Ready to use Python function to convert any number to bytes, KB, MB, and GB: Write your main code as a sample below, The output of the code is, The function convert_bytes takes an argument bytes which is a numerical value representing the number of bytes. The function then converts the number of bytes to […]

Read More