Python | Dump a Dict to JSON File

Dumping Dict to JSON

A Dict in Python is a Data Structure which looks like {“Apple” : 10, “Banana”: 54, “Grapes”: 34} what if you want to store this dictionary into a JSON file. Best method to do this is to use JSON Python Package do not worry you don’t need to install this explicitly as it’s already installed … Read more

Code for Binary Search Algorithm (Python)

What does Binary Search Algorithm do? Given a sorted array of n elements, write a function to search for the index of a given element (target). Process of working of Binary Search Algorithm? Search for the array by dividing the array in half repeatedly. Initially consider the actual array and pick the element at the … Read more

PDFPlumber – Extracting Text Out of PDF

In this article, I will be discussing how to use the Python Programming language for extracting text out of a PDF using a Python Package called PDFPlumber. Let’s straightforward dive into how to use PDFPlumber for getting text out of a PDF using Python. Installing PDFPlumber PDFPlumber can be installed on a computer/laptop using pip, … Read more

Python input() Function – Taking User Input

input() function in Python Programming Language for taking in user input

Any Software System or program written in any programming language at the end would be used by some user. So there need to be some way to send data inside a software system. For this Python uses built-in function input(), which asks user to enter some data( like string, number).So input() function would put a … Read more

Python Statement, Indentation and Comment

Explaining Python Statements, Python Indentation, Python Comments

In this article, I will discuss about Basics of Python Programming Language explaining what’s meaning of Statement, Indentation and Comment in Python.Let’s straightforward dive into meaning of each of these in Python. Statements in Python Statement in Python is just a line of code for doing some specific task. For example a = 10 is … Read more

Python Program to Find All Links on Webpage

Extracting URLs from a Webpage Using Python

In this article, I will discuss about How Python Programming Language can be used for extracting all of links in a webpage.This program will will use Python Modules – urllib.request and re.Using function urlopen form urllib.request, we can retrive the a webpage from a server as a HTTP Response Object. For extracting html code out … Read more

Check Sound File Type Using Python

Checking sound file type using python programming language

If any sound file is given and you want to check what is file type of it, then Python module sndhdr can be used. Python Code for Checking Sound File Type Above Python Code may print out wav, sb, ub, ul or other sound file types names.

Check Image File Type Using Python

Python Code to check File Type of Image like its jpeg, png or something else

If any image is given and you want to check its file type, then python module imghdr can be used. Python Code for Checking Image File Type Import imghdr module Pass name of file to imghdr module function what() what() function will return image file type like gif, pgm, jpeg That’s it just two lines … Read more

Listing Files in a Zip File Using Python

Python code to list all of files in a Zip File

Python can be used for seeing what’s inside a Zip File without even unzipping it. In this article, I’ll discuss How to list all of file names inside a zip file using Python? Steps for Listing File Names in Zip File Import zipfile module Read in a zip file as a File Object using zipfile.ZipFile(filepath, … Read more