Page 102 - KEC Khaitan C8 Flipbook
P. 102
capitalize(): The capitalize() method returns a string with the first character capitalized and
the rest in lowercase.
Syntax:
string_name.capitalize()
title(): The title() method returns a string with the first letter of each word capitalized.
Syntax:
string_name.title()
swapcase(): The swapcase() method returns a string with uppercase characters converted to
lowercase and vice versa.
Syntax:
string_name.swapcase()
casefold(): The casefold() method returns a case-insensitive version of the string for comparison
purposes.
Syntax:
string_name.casefold()
find(sub): The find() method returns the lowest index where the substring sub is found in the
string, or -1 if it is not found.
Syntax:
string_name.find(sub)
replace(old, new): The replace() method returns a new string where all occurrences of the
substring old are replaced with new.
Syntax:
string_name.replace(old, new)
split(sep): The split() method splits the string into a list of substrings using the specified
separator sep.
Syntax:
string_name.split(sep)
join(iterable): The join() method concatenates an iterable of strings into a single string, using
the original string as a separator.
Syntax:
string_name.join(iterable)
strip(): The strip() method returns a copy of the string with leading and trailing whitespace
removed.
Syntax:
string_name.strip()
100 Premium Edition-VIII

