• Posted by allwinraju
  • December 19, 2020
  • 0 Comments

Python one-liners

This blog post contains some of the python one-liners which I have gathered from various sources. The link to the repository is given below. If you are interested you can also add your own one-liners if I have missed any. https://github.com/Allwin12/python-one-liners anagram binary to decimal convert string to lower case convert string to upper case […]

Read More
  • Posted by allwinraju
  • October 10, 2020
  • 0 Comments

Find if a string is empty in python

This blog post discusses which is the best method to find if a string is empty in python. We all would have known about the naive method. But let us see which one is the most effective and efficient method to find the empty string. In the naive method we would do something just like […]

Read More

Lesser-known methods in Django ORM

We all know Django provides ORM right out of the box thus preventing us from writing SQL queries. This mechanism has a lot of potentials. Most of us will be dealing only with the filter(), get(), all(), update() and delete() methods from the Django ORM. But Django ORM provides a lot of other options in […]

Read More

Django — Get browser and OS info from the HTTP requests

This blog post focuses on finding various information about the nature of the browser and os from which the HTTP requests are made. The following information can be obtained from the requests. If the device is a mobile/PC Browser name Browser version OS of the computer or mobile OS version Device name Let us get […]

Read More
  • 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