isspace() function in python by R4R Team

-issapce() is a python function which return True if string have only space or it will return false if any character present in string.

Example-

string is "try sapce"
it will return False

string is " "
it will return True

program-

print("Enter any string")
s1=input()
print(s1.isspace())
print("Enter any string")
s2=input()
print(s2.isspace())
s3=" "
print("String with only space will give ",s3.isspace())


output-

Enter any string
try
False
Enter any string
again try with space
False
String with only space will give True


-In this program, s3 string are only the space so it will give true and other string will give false.
Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!