Python String isascii()

Checks whether all characters are ASCII (True or False). 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.isascii() Checks whether all characters are ASCII (True or False). Border case: The empty string is considered to be an ASCII symbol: … Read more

Python String isalpha()

Checks whether all characters are alphabetic (True or False). 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.isalpha() Checks whether all characters are alphabetic (True or False). Border case: If the string is the empty string, returns False. What … Read more

Python String isalnum()

Checks whether all characters are alphabetic or numeric (True or False). 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.isalnum() Checks whether all characters are alphabetic or numeric (True or False). More specifically, a character c is alphanumeric if … Read more

Python String casefold()

Return a lowercased, casefolded string similar to lowercase() but more aggressive. 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.casefold() Return a lowercased, casefolded string similar to lower() but more aggressive because it removes all case distinctions. For example, … Read more

Python String center()

Return a centered string of a certain length, padded with whitespace or custom 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.center(width[, fillchar]) Return a centered string of a certain length, padded with whitespace or custom characters. You … Read more

Python String count()

Return the number of non-overlapping occurrences of a substring. 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.count(sub[, start[, end]]) Returns the number of non-overlapping occurrences of a substring sub. As optional arguments, you can set a range between … Read more

Python String encode()

Returns a byte object that is an encoded version of the 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.encode(encoding=”utf-8″, errors=”strict”) Returns a bytes object that is an encoded version of the string. The default encoding is ‘utf-8’. … Read more

Python String endswith()

Returns whether the string ends with a given value or not (True or False). 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.endswith(suffix[, start[, end]]) Returns whether the string ends with a given value or not (True or False). … Read more

Python String expandtabs()

Return a string with spaces instead of tab 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.expandtabs(tabsize=8) Return a string with spaces instead of tab characters. In particular, it replaces all tab characters with one or more spaces. … Read more

Python String find()

Returns the index of the first occurrence of the specified substring. 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.find(sub[, start[, end]]) Returns the index of the first occurrence of the specified substring. In particular, return the lowest index … Read more

Python String format()

Formats the string according to the Format Description Language. 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.format(*args, **kwargs) Formats the string according to the Format Description Language. The string can contain normal text, enriched with so-called replacement fields … Read more

Python String format_map()

Formats the string according to the Format Description Language, passing a mapping object. 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.format_map(mapping) Formats the string according to the Format Description Language, passing a mapping object. In that way, it … Read more