Python String

Strings – you use it in every program, just like any other programming language. Learn about Strings in Python and how to manipulate them in the Pythonic way.

Python String partition() method

In this article, we will have a look over the functioning of the Python string partition() method. Python String has introduced a large number of built-in functions to manipulate the input string/data. Getting started with Python String partition() Python String partition() method is used to split the input string at the very initial/first occurrence of […]

Python String partition() method Read More »

Python String swapcase() method

In this article, we will unveil the Python String swapcase() function in detail. Python String provides us with a number of built-in methods to manipulate the input data for further operations. Let’s get started with understanding this method. Getting started with Python String swapcase() method Python String swapcase() function converts the case of each character

Python String swapcase() method Read More »

Python string zfill()

The Python string zfill() method is used to pad a string with zeros on the left until a specific width is reached. This is the most “Pythonic” way to add padding to a string, instead of manually iterating using for loops. Syntax of Python String zfill() Method The Python string zfill() function belongs to the

Python string zfill() Read More »

Python String lower() Method

Python String lower() method converts a string object into a lower case string. This is one of the builtin string functions in Python. Since strings are immutable in Python, this method only returns a copy of the original string. Syntax and Usage of Python String lower() Method Format: Here, str_copy is the lowercase string of

Python String lower() Method Read More »

Find String Length in Python

We can find string length in Python using the built-in len() function. Let’s look at how this function works, and also let’s try finding the length of various types of Python strings using len(). Using len() Let’s look at some simple examples to illustrate len(). This prints 20 because it is the number of characters

Find String Length in Python Read More »

Python String find()

The Python string find() method is used to check if a string is a substring of another string. Often, when we want to check if a string contains another string, find() is very useful to solve this problem. Let us understand how we can use this, through some simple examples. Syntax of Python String Find()

Python String find() Read More »

Python String translate()

Python’s in-built method for the String class, str.translate(), is used to map a string with a translation table. The translate() method simply converts it using the translation table rules. Let’s understand more about the method in this article. Syntax of Python String translate() Since the translate() function returns a new string with each character in

Python String translate() Read More »