• Posted by allwinraju
  • September 28, 2020
  • 0 Comments

Get file size using python

In this article, we shall see how to get file size with python using built-in libraries. The os module and the pathlib module in python can be used to find the size of a file. This blog post deals with the following three ways to find the file size using python. All these methods will […]

Read More
  • Posted by allwinraju
  • September 20, 2020
  • 0 Comments

Comparing directories using python

In this article, we shall see how to compare two directories using the built-in module in python called “filecmp”. This module cannot be used to compare the contents of two files. It rather will compare the files and subdirectories in the two given directories. In order to compare the contents of two files, there is […]

Read More
  • Posted by allwinraju
  • September 19, 2020
  • 0 Comments

Convert a list of strings to upper case or lower case using python

In this article, we shall see how to convert a list of strings from upper to lower case or from lower to upper case using python. This can be achieved either using list comprehension or using map method and lambda function. Let us get started. Convert to lower case Consider the following list of strings. […]

Read More
  • Posted by allwinraju
  • September 15, 2020
  • 0 Comments

Statistics library in python

Python has a built-in library called statistics. This module provides functions for calculating mathematical statistics of numeric (Real-valued) data. Unless explicitly noted, these functions support int, float, Decimal and Fraction. Some of the most common methods supported by this module are, mean() fmean() geometric_mean() median() median_low() median_high() mode() multimode() Let us look at the above methods one by one with […]

Read More
  • Posted by allwinraju
  • September 11, 2020
  • 0 Comments

Run two loops simultaneously in python

In this article we shall see how to runs two loop simultaneously using python. This can be achieved by the zip() method. Using the zip() method In order to use the zip() function, first, we must know what this function does. According to the documentation, We will be using two range function to generate numbers […]

Read More
  • Posted by allwinraju
  • September 8, 2020
  • 0 Comments

Dynamic variables using python

In this article we shall see how to create dynamic variables in python. This will be helpful in scenarios where the user’s input has to be stored in a variable and access in later part of the program. Dynamic variables can be created using the following two ways. exec() dictionary Let us look at the […]

Read More
  • Posted by allwinraju
  • September 6, 2020
  • 0 Comments

Reverse words in a string using python

In this article, we shall see how to reverse words in a string using python. The mistake most often we make is we would reverse the entire string and not the words. Consider the following string. “Welcome to python coders blog” When somebody asks us to reverse the words what we have to is, and […]

Read More

List initialization in python

In this article we shall see how to initialise an empty list or a list of size n initialised with a value. The list initialisation can be done in the following ways. Using the list() We can directly initialise a list using the list() keyword. This will create an empty list for us. Using [] […]

Read More

Get metadata of a python package

In this article, we shall see how to find the metadata from a python package installed via pip from the pypi.org. Python has a built-in library called importlib_metadata which can be used to obtain these data. What metadata can be obtained? This library has a class called metadata which can be used to get almost […]

Read More