'
), double quotes ("
), and triple quotes ('''
or """
) for defining strings.+
operator.*
operator.0
).string[start:stop:step]
len()
function.upper()
and lower()
strip()
, lstrip()
, and rstrip()
replace()
split()
join()
find()
and index()
find()
returns -1
if the substring is not found, while index()
raises an error.startswith()
and endswith()
isalpha()
, isdigit()
, isalnum()
f-strings
(Python 3.6+){}
.format()
Method{}
.%
Formatting (Older Style)%
as a placeholder for values.\n
: Newline\t
: Tab\\
: Backslash\"
: Double quote\'
: Single quotef-strings
for string formatting (Python 3.6+).+
for concatenating many strings (use join()
instead for efficiency).