You are on page 1of 1

capitalize casefold center count

Returns centred string using optional value as fill Return no of times value is in string. Optional parameters
Convert first character to upper case and rest lowercase Convert string to lower case. More aggresive than lower() character. Space (" ") is default specify where to search in string

encode endswith expandtabs find


Return encoded version of string. Optional parameter Set tab size of string to specified number of Return position of value if found in string. -1 returned if string not
encoding & errors specify encoding to use and error method Return true if string ends with value whitespaces. Default is 8 found. 2 optional params specifying where to start & end search

format format_map index isalnum


Return position of value if found in string. Raise exception if not
Format values in string Format values in string using map-based substitution found. 2 optional params specifying where to start & end Return true if all string characters are alphanumeric
search

isalpha isascii isdecimal isdigit


Return true if all string characters are decimals (0-9).
Return true if all string characters are in alphabet Return true if all string characters are ascii Can work on Unicode. Only supports decimals Return true if all string characters are digits

isidentifier isnumeric isprintable islower


Return true if string is an identifer. These can only contain
alphanumeric chars & underscores & can't start with numbers Return true if all characters are numeric Return true if all characters are printable Return true if all characters are lower case

isspace isupper
Return true if all characters are whitespaces
Return true if all characters are upper case

istitle
Python join
Return true if string follows rules of a title (all words are
lowercase except the first letter of each word) STRING METHODS Join iterable elements to end of stiring

By @AbzAaron

ljust lower lstrip maketrans


Return string left justified. 2nd optional param specifies Return translation table that can be used with
character to fill space. Default is space. Convert string to lower case Same as strip but only leading chars translate().Check docs for more details on maketrans()

partition replace rfind rindex


Return tuple with string parted in 3 parts. Middle part is Return string where one value is replaced with another.
specified string. If not found, entire string stored in first part of Optional parameter specifies how many occurrences to replace Same as find but searches for last occurrence of string Same as index but searches for last occurence of string
tuple

rjust rpartition rsplit rstrip


Return string right justified. 2nd optional param specifies
character to fill space. Default is space. Same as partition but searches for last occurence of string Same as split but starts from the right Same as strip but only trailing chars

split splitlines startswith strip


Split string at whitespace and return list. 2 optional params Split string at linebreaks and return list. Optional param Remove leading & trailing chars. Optional param
allow you to specify separator and how many splits to do. determines whether to include line break after split Return true if string starts with value specifies chars to remove as leading/trailing chars

swapcase title translate upper


Returns a translated string using mapping table, or
Swap cases (e.g. lowercase become upper) Covert first character of each word to upper case dictionary with ascii characters Convert characters to uppercase

zfill removeprefix removesuffix Consider


Fills string with specified number of 0 values at start Return string without specified prefix. Only Python 3.9+ Return string without specified suffix. Only Python 3.9+ Supporting Me!

@AbzAaron

You might also like