|
str()
|
convert an object to a string
|
string.split("sep"; maxsplit = ) |
split a string into a list of substrings. By default, it uses whitespace (spaces, tabs, and newlines) as the delimiter
|
"sep".join(object) |
concatenate the elements of an iterable object into a string
|
|
string + string
|
string * int
|
|
str.place(a, b)
|
replace a by b in a string
|
|
str.count(a)
|
count thte number of a in a string
|
|
str.title()
|
|
|
str.upper()
|
|
|
str.lower()
|
|
str.strip("character") |
remove leading and trailing specific charaters. By default, whitespaces (spaces, tab, newline)
|
str.rstrip("character") |
remove trailing specific character. By default, whitespaces
|
str.lstrip("character") |
remove leading specific charachter. By default, whitespaces
|
|
str.isalpha()
|
check whether all the characters in a string are alphabeti. return True or False
|
|
str.isnumeric()
|
check whether all the characters in a string are numeric
|
|
str.isdecimal()
|
check whether all characters in a string are decimal digits (0-9)
|
|
str.finf("to_find")
|
find the first occurrence of a specified substring within a string. It returns the index of the first character of the substring if found, and -1 if the substring is not present in the string
|
|
str.startwith("...")
|
|
|
\n
|
\\
|
|
\t
|
\"
|
|
\'
|
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.