Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 29, 2020 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/1b3d523f61410ff82b727adad58da214 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/1b3d523f61410ff82b727adad58da214 to your computer and use it in GitHub Desktop.
#whitespace
s1=" "
print (len(s1))
print (s1.isspace())#Output:True
s2="hello world"
print (s2.isspace())#Output:False
#newline character
s3="\n"
print (s3.isspace())#Output:True
#horizontal tab
s4="\t"
print (s4.isspace())#Output:True
#vertical tab
s5="\v"
print (s5.isspace())#Output:True
#Carriage return
s6="\r"
print (s6.isspace())#Output:True
#feed
s7="\f"
print (s7.isspace())#Output:True
#empty string containing no whitespace
s8=''
print (s8.isspace())#Output:False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment