Posts From Python String

Python String Contains

Python String contains()

In this article, we’ll take a look at finding whether one Python string contains another string. How can we easily do it? Python has a built-in string method String.__contains__(), which we can use easily. Let’s look at how we can use this method. Syntax of String.__contains__() This function will take two strings, and return if […]

Python F String Function

Understanding Python f-string

String formatting in Python can be achieved using f-string. Thus, in this article, we will be focusing on the implementation of Python f-string. Necessity of f-string in Python Python f-string basically serves the purpose of string formatting. Before the emergence of “f-strings”, we had the following ways to format strings in Python: 1. Python ‘%’ […]

4 Ways To Append Multiple Python Strings

4 Easy Methods to Append Multiple Strings in Python

In this article we will be having a look at the different ways to interpolate and append multiple strings in Python. String interpolation involves an injection of string in a particular statement. Let’s get right into it! Technique 1: f-string to append multiple strings in Python Python f-string is also known as format-strings have proved […]

3 Ways To Trim A Python String

3 ways to trim a String in Python

What do you mean by trimming a string and how can you trim a string in Python? When you remove the whitespace around strings of text, in technical terms we call it trimming a string. In this article, we’ll cover 3 methods to trim a string in Python. Technique 1: The strip() to Trim a […]

String Slicing In Python

How to Slice Strings in Python?

Introduction In this tutorial, we are going to learn how we can slice strings in Python. Python supports the slicing of strings. It is the creation of a new sub-string from the given string on the basis of the user-defined starting and ending indices. Ways to Slice Strings in Python If you want to slice […]

4 Ways To Check For The Equality Of Python Strings

String Equals Check in Python – 4 Easy Ways

In this article, we will be having a look at the different ways to perform a string equals check in Python. String comparison is basically the comparison of two strings i.e. it the procedure through which we check for the equality of strings by comparing the strings character-by-character. Technique 1: Python ‘==’ operator to check […]