Docsity

Python String Methods and Their Descriptions, Summaries of Programming Languages

Toggle sidebar
bg1
Python String Methods
MethodDescription
Capitalize() Converts the first character to upper case
Casefold() Converts string into lower case
Center() Returns a centered string
Count() Returns the number of times a specified value occurs in a string
Encode() Returns an encoded version of the string
Endswith() Returns true if the string ends with the specified value
Expandtabs() Sets the tab size of the string
Find() Searches the string for a specified value and returns the position of where it was found
Format() Formats specified values in a string
Format_map() Formats specified values in a string
Index() Searches the string for a specified value and returns the position of where it was found
Isalnum() Returns True if all characters in the string are alphanumeric
Isalpha() Returns True if all characters in the string are in the alphabet
Isdecimal() Returns True if all characters in the string are decimals
Isdigit() Returns True if all characters in the string are digits
Isidentifier() Returns True if the string is an identifier
Islower() Returns True if all characters in the string are lower case
Isnumeric() Returns True if all characters in the string are numeric
Isprintable() Returns True if all characters in the string are printable
Isspace() Returns True if all characters in the string are whitespaces
Istitle() Returns True if the string follows the rules of a title
Isupper() Returns True if all characters in the string are upper case
Join() Joins the elements of an iterable to the end of the string
Ljust() Returns a left justified version of the string
Lower() Converts a string into lower case
Lstrip() Returns a left trim version of the string
Maketrans() Returns a translation table to be used in translations
pf2

Partial preview of the text

Download Python String Methods and Their Descriptions and more Summaries Programming Languages in PDF only on Docsity!

Python String Methods MethodDescription Capitalize() Converts the first character to upper case Casefold() Converts string into lower case Center() Returns a centered string Count() Returns the number of times a specified value occurs in a string Encode() Returns an encoded version of the string Endswith() Returns true if the string ends with the specified value Expandtabs() Sets the tab size of the string Find() Searches the string for a specified value and returns the position of where it was found Format() Formats specified values in a string Format_map() Formats specified values in a string Index() Searches the string for a specified value and returns the position of where it was found Isalnum() Returns True if all characters in the string are alphanumeric Isalpha() Returns True if all characters in the string are in the alphabet Isdecimal() Returns True if all characters in the string are decimals Isdigit() Returns True if all characters in the string are digits Isidentifier() Returns True if the string is an identifier Islower() Returns True if all characters in the string are lower case Isnumeric() Returns True if all characters in the string are numeric Isprintable() Returns True if all characters in the string are printable Isspace() Returns True if all characters in the string are whitespaces Istitle() Returns True if the string follows the rules of a title Isupper() Returns True if all characters in the string are upper case Join() Joins the elements of an iterable to the end of the string Ljust() Returns a left justified version of the string Lower() Converts a string into lower case Lstrip() Returns a left trim version of the string Maketrans() Returns a translation table to be used in translations

Partition() Returns a tuple where the string is parted into three parts Replace() Returns a string where a specified value is replaced with a specified value Rfind() Searches the string for a specified value and returns the last position of where it was found Rindex() Searches the string for a specified value and returns the last position of where it was found Rjust() Returns a right justified version of the string Rpartition() Returns a tuple where the string is parted into three parts Rsplit() Splits the string at the specified separator, and returns a list Rstrip() Returns a right trim version of the string Split() Splits the string at the specified separator, and returns a list Splitlines() Splits the string at line breaks and returns a list Startswith() Returns true if the string starts with the specified value Strip() Returns a trimmed version of the string Swapcase() Swaps cases, lower case becomes upper case and vice versa Title() Converts the first character of each word to upper case Translate() Returns a translated string Upper() Converts a string into upper case Zfill() Fills the string with a specified number of 0 values at the beginning