Python String Method
isalnum()
returns True if all characters in the string are alphanumeric
isdigit()
returns True if all characters in the string are digits
isalpha()
returns True if all characters in the string are in the alphabet
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
isupper()
returns True if all characters in the string are upper case
isspace()
returns True if all characters in the string are whitespaces
istitle()
returns True if the string follows the rules of a title
isidentifier()
returns True if the string is an identifier
center()
returns a centered string
ljust()
returns a left justified version of the string
lstrip()
returns a left trim version of the string
rstrip()
returns a right trim version of the string
replace()
returns a string where a specified value is replaced with a specified value
translate()
returns a translated string
maketrans()
returns a translation table to be used in translations
partition(), rpartition()
returns a tuple where the string is parted into three parts
encode()
returns an encoded version of the string
count()
returns the number of times a specified value occurs in a string
endswith()
returns true if the string ends with the specified value
startswith()
returns true if the string starts with the specified value
rfind(), rindex(), find()
searches the string for a specified value and returns the last position of where it was found
index()
searches the string for a specified value and returns the position of where it was found
expandtabs()
sets the tab size of the string
splitlines()
splits the string at line breaks and returns a list
split(), rsplit()
splits the string at the specified separator, and returns a list
swapcase()
swaps cases, lower case becomes upper case and vice versa
isdecimal()
Returns True if all characters in the string are decimals
upper()
converts a string into upper case
capitalize()
converts first character to uppercase
title()
converts the first character of each word to upper case
casefold(), lower()
coverts string to lowercase
zfill()
fills the string with a specified number of 0 values at the beginning
format(), format_map()
formats specified values in a string
join()
joins the elements of an iterable to the end of the string