Python String

Python String translate()

Returns a translated string. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.translate(table) Returns a translated string that is a copy of the original string whereas only the character translations defined in the table argument have been applied to …

Python String translate() Read More »

Python String title()

Returns a new string with uppercase first characters of each word. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.title() Returns a new string with uppercase first characters of each word. A titlecased string is a string where each …

Python String title() Read More »

Python String swapcase()

Swaps lowercase to uppercase characters and vice versa. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.swapcase() Swaps lowercase to uppercase characters and vice versa. Note: Although you may expect that swapcase() is its own inverse function, this is …

Python String swapcase() Read More »

Python String strip()

Trims whitespaces on the left and right and returns a new string. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.strip([chars]) Trims whitespaces on the left and right and returns a new string. chars – optional. The argument defines …

Python String strip() Read More »

Python String split()

Splits the string at a given separator and returns a split list of substrings. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.split(sep=None, maxsplit=-1) Splits the string at a given separator and returns a split list of substrings. Return …

Python String split() Read More »

Python String rstrip()

Trims whitespaces on the right and returns a new string. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.rstrip([chars]) Trims whitespaces on the right and returns a new string. chars – optional. The argument defines the set of characters …

Python String rstrip() Read More »

Python String rsplit()

Splits the string at a given separator and returns a split list of substrings. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.rsplit(sep=None, maxsplit=-1) Splits the string at a given separator and returns a split list of substrings. sep …

Python String rsplit() Read More »

Python String rpartition()

Searches for a separator substring and returns a tuple with three strings: (1) everything before the separator, (2) the separator itself, and (3) everything after it. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.rpartition(sep) Searches for the last …

Python String rpartition() Read More »

Python String rjust()

Returns a right-justified string filling up the left-hand side with fill characters. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.rjust(width[, fillchar]) Returns a right-justified string filling up the left-hand side with fill characters. width – the number of …

Python String rjust() Read More »

Python String rindex()

Return the highest index in the string where a substring is found. Returns ValueError if not found. Minimal Example As you read over the explanations below, feel free to watch our video guide about this particular string method: Syntax and Explanation str.rindex(sub[, start[, end]]) Return the highest index in the string where a substring is …

Python String rindex() Read More »