Category Archives: Python

XML parsing in Python

This article focuses on how one can parse a given XML file and extract some useful data out of it in a structured way. XML: XML stands for eXtensible Markup Language. It was designed to store and transport data. It was designed to be both human- and machine-readable.That’s why, the design goals of XML emphasize… Read More »

struct module in Python

This module performs conversions between Python values and C structs represented as Python bytes objects. Format strings are the mechanism used to specify the expected layout when packing and unpacking data. Module struct is available in Python 3.x and not on 2.x, thus these codes will run on Python3 interpreter. Struct Functions struct.pack() Syntax: struct.pack(format,… Read More »

Precision Handling in Python

Python in its definition allows to handle precision of floating point numbers in several ways using different functions. Most of them are defined under the “math” module. Some of the most used operations are discussed in this article. 1. trunc() :- This function is used to eliminate all decimal part of the floating point number… Read More »

Inplace vs Standard Operators in Python

Inplace Operators – Set 1, Set 2 Normal operators do the simple assigning job. On other hand, Inplace operators behave similar to normal operators except that they act in a different manner in case of mutable and Immutable targets. The _add_ method, does simple addition, takes two arguments, returns the sum and stores it in… Read More »

Working with PDF files in Python

All of you must be familiar with what PDFs are. In-fact, they are one of the most important and widely used digital media.  PDF stands for Portable Document Format. It uses .pdf extension. It is used to present and exchange documents reliably, independent of software, hardware, or operating system. Invented by Adobe, PDF is now… Read More »

Keywords in Python | Set 2

Python Keywords – Introduction Keywords in Python | Set 1 More keywords: 16. try : This keyword is used for exception handling, used to catch the errors in the code using the keyword except. Code in “try” block is checked, if there is any type of error, except block is executed. 17. except : As… Read More »

Packaging and Publishing Python code

If you have been coding in python, even for a while, you must be familiar with the concept of ‘pip’ by now. It is a package management system used to install and manage software packages/libraries written in Python. Then one may ask that where are all these packages/libraries stored? It is obvious that there must… Read More »

Keywords in Python | Set 1

Python Keywords – Introduction This article aims at providing a detailed insight to these keywords. 1. True : This keyword is used to represent a boolean true. If a statement is truth, “True” is printed. 2. False : This keyword is used to represent a boolean false. If a statement is False, “False” is printed.… Read More »

Timeit in Python with Examples

This article will introduce you to a method of measuring the execution time of your python code snippets. We will be using an in-built python library timeit. This module provides a simple way to find the execution time of small bits of Python code. Why timeit? Well, how about using simple time module? Just save… Read More »

Command Line Interface Programming in Python

This article discusses how you can create a CLI for your python programs using an example in which we make a basic “text file manager”. Let us discuss some basics first. What is a Command Line Interface(CLI)? A command-line interface or command language interpreter (CLI), also known as command-line user interface, console user interface, and… Read More »

Operator Functions in Python | Set 2

Operator Functions in Python | Set 1 More functions are discussed in this article. 1. setitem(ob, pos, val) :- This function is used to assign the value at a particular position in the container. Operation – ob[pos] = val 2. delitem(ob, pos) :- This function is used to delete the value at a particular position… Read More »