isspace()
This method helps us to check whether all the characters in string are spaces or not .
Syntax
string.isspace()
Returns “True” if all the characters in the text are spaces otherwise returns “False”.
Example:
#isspace() n=" " print(n.isspace()) n="HELLO" print(n.isspace()) x=n.isspace() print(x)
Output:
True
False
False
>>>
istitle()
The istitle() method returns True if all words in a text start with a upper case letter, AND the rest of the word are lower case letters, otherwise False.
Symbols and numbers are ignored.
Syntax
string.istitle()
Example:
#istitle() n="Hello How Are You" print(n.istitle()) n="HELLO" print(n.istitle()) n="hello World" x=n.istitle() print(x)
Output:
True
False
False
>>>
lower()
This method converts all upper case alphabet characters of string to lower case.
Symbols and Numbers are ignored.
Syntax
string.lower()
Example:
#lower() n="Hello How Are You" print(n.lower()) n="HELLO" print(n.lower()) n="hello World" x=n.lower() print(x)
Output:
hello how are you
hello
hello world
>>>
upper()
This method converts all lower case alphabet characters of string to upper case.
Symbols and Numbers are ignored.
Syntax
string.upper()
Example
#upper() n="Hello How Are You" print(n.upper()) n="HELLO" print(n.upper()) n="hello World" x=n.upper() print(x)
Output:
HELLO HOW ARE YOU
HELLO
HELLO WORLD
>>>