Skip to content

Tag Archives: Python-string-functions

Given a string S and an integer N, the task is to remove N characters from the end of the string S. Input: S =… Read More
In Python, to find the index of a substring in a string can be located by python’s in-built function using find() or index(). Both of… Read More
In this article, the task is to display scientific notation as float in Python. Scientific notation means any number expressed in the power of 10.for… Read More
Both title() and capitalize() have similar functionality of capitalizing first characters. Let us see the difference between the two of them. title() title() function in… Read More
In this article we will use str.removeprefix(prefix, /) function which removes the prefix and returns the rest of the string. If the prefix string is… Read More
Given a string in Python. The task is to check whether the string has at least one letter(character) and one number. Return “True” if the… Read More
Prerequisites: Python – format() function str.format() is one of the string formatting methods in Python3, which allows multiple substitutions and value formatting. This method lets… Read More
Title case is a style of writing that is used for the titles of articles, books, movies, and other works. The rules for writing in… Read More
In Python, string capwords() method is used to capitalize all the words in the string using spilt() method. Syntax: string.capwords(string, sep=None) Return Value: Returns a… Read More
In Python3, string.octdigits is a pre-initialized string used as string constant. In Python, string.octdigits will give the octadecimal letters ‘01234567’. Syntax : string.octdigits Parameters :… Read More
In Python3, string.punctuation is a pre-initialized string used as string constant. In Python, string.punctuation will give the all sets of punctuation. Syntax : string.punctuation Parameters… Read More
In Python3, string.whitespace is a pre-initialized string used as string constant. In Python, string.whitespace will give the characters space, tab, linefeed, return, formfeed, and vertical… Read More
Given a string of letters, write a python program to sort the given string in an alphabetical order. Examples: Input : PYTHON Output : HNOPTY… Read More
lstrip() method returns a copy of the string with leading characters removed (based on the string argument passed). If no argument is passed, it removes… Read More
translate() returns a string that is modified string of givens string according to given translation mappings. There are two ways to translate : Providing a… Read More