Posts From Python String

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 – Concatenate string and int

In Python, we normally perform string concatenation using the + operator. The + operator, however as we know, is also used to add integers or floating-point numbers. So what would happen if we have a string and an int on both sides of the operand? Since Python is a dynamically typed language, we would not […]

Python String split() function

Python string split() functions enable the user to split the list of strings. It’s very useful when we are working with CSV data. String split() function syntax separator: It basically acts as a delimiter and splits the string at the specified separator value. maxsplit: It is a limit up to which the string can be […]

Python String isnumeric() Function

Python String isnumeric() function returns True if all the characters in the input string are found to be of numeric type, else it returns False. A numeric character can be of the following type: numeric_character=Decimal numeric_character=Digit numeric_character=Numeric Syntax: isnumeric() arguments: The isnumeric() function dosen’t take any argument as input. Python isnumeric() Examples Example 1: Output: […]

Python encode() and decode() Functions

Python’s encode and decode methods are used to encode and decode the input string, using a given encoding. Let us look at these two functions in detail in this article. Encode a given String We use the encode() method on the input string, which every string object has. Format: This encodes input_string using encoding, where […]

Python String endswith() function

Python string endswith() function returns True if the input string ends with a particular suffix, else it returns False. Key Points: Return Type: Boolean i.e. True or False Parametric Values: There are 3 parameters: Suffix, Start, End Parameter Description Suffix It can be a String or Tuple of Strings that are to be checked. It isCase Sensitive […]