Category 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 Template Strings

Python’s Template String Class provides a way for simple string substitution, wherein the template fields are substituted with suitable replacement strings provided by the user. Sometimes, it may be a preference to have an easier to replace string, rather than…

Python Remove Spaces from String

Python provides various ways to remove white-spaces from a String. This article will focus of some of the efficient techniques to remove spaces from a String. Either of the following techniques can be used to get rid of the spaces…

Python String startswith() Function

String in Python has built-in functions for almost every action to be performed on a string. Python String startswith() function checks for the specific prefix in a string and returns True else False. Key Points: Return Type: Boolean i.e. True…

Python String Substring

Substring is a portion of the string that can be extracted and represented as a new string. In this tutorial, we will learn how to work with Substrings in Python. 1. Creating Python String Substring Substring can be created using…

String Comparison in Python

The following are the ways to compare two string in Python: By using == (equal to) operator By using != (not equal to) operator By using sorted() method By using is operator By using Comparison operators 1. Comparing two strings…

Python Reverse String

Strings are basically sequence of characters. Python doesn’t support in-built string functions such as reverse() to reverse a string. The following are the ways to reverse a string in Python: By using a for loop By using a while loop…

Python String Functions

Python has built-in functions for almost every operation that is to be performed on a string. To make it simple, these are classified on the basis of the frequency of their use as well as their operations. They are as…

String Concatenation in Python

Concatenation is a method of joining strings together to form a new string altogether. The following are the methods to perform String Concatenation in Python: By using + operator By using join() method By using % operator By using format()…