• 04 October

    Get Every Other Element in List in Python

    A list is one of the more versatile data types among the others provided in Python. As we know lists can store multiple items in one single variable, there is often a need to get only a handful of items from a given list. Get Every Other Element in List in Python This tutorial focuses […]

  • 03 October

    Convert String to Raw String in Python

    Raw strings provide a useful way to describe strings in Python so that the backslashes and their succeeding characters are not interpreted as escape sequences. The interpreter does not implement the escape sequence in such strings but rather considers them as normal characters. This tutorial will demonstrate how to convert string to raw string in […]

  • 02 October

    Get Temp Directory in Python

    Sometimes we can encounter scenarios where we wish to store temporary data in Python. This can include situations of creating temporary files and directories. In this tutorial, we will discuss how to get temp directory in Python. Get Temp Directory in Python The tempfile module is used in Python to work with and create temporary […]

  • 02 October

    Replace Single Quotes with Double Quotes in Python

    In Python, strings represent a collection of characters and can be operated on easily using different functions. In this tutorial, we will discuss different methods to replace single quotes with double quotes in Python. Replace Single Quotes with Double Quotes in Python There are multiple way to replace single quotes with double quotes in Python. […]

  • 27 September

    Print Number without Decimal in Python

    Python provides a float data type that allows the storage of floating-point numbers. The data at the decimal places is also retained while using the float data type. However, sometimes there is a need to access only the whole number rather than including the decimal part. This tutorial discusses the different ways available to print […]

  • 26 September

    Print hex without 0x in Python

    A hex or a hexadecimal string is one of the few forms of data types provided by Python for storing and representing data. A hex string is generally represented with a prefix of 0x. However, we can get rid of this 0x and print just the original hex value. This tutorial focuses on and demonstrates […]

  • 26 September

    Check if Date Is Between Two Dates in Python

    Python allows us to store and work with date values very efficiently by providing the datetime module. This module has datetime objects that can store date and time values. There are other third-party packages as well that allows us to work with such values. We can also store dates as strings in Python. In this […]

  • 26 September

    Prefix r before String in Python

    💡 Quick Definition Prefix r before String denotes raw Strings in Python. Python raw string considers backslash (\) as a literal character. This is generally preferred when you don’t want to treat backslash character as escape character. Here is an example: [crayon-6631459fe5c16764732797/] Output: \n \t are escape characters in Python Escape sequences provide an efficient […]

  • 26 September

    Print bytes as hex in Python

    Print Bytes as Hex in Python Bytes are encoded in ASCII and have a very dynamic role in Python. In Python 2, they were merely an alias to strings. However, Python 3 changed its definition as strings were now encoded as Unicode characters instead of ASCII encoded bytes. Since bytes are ASCII encoded, the characters […]