isspace(): checking white space only in a string in Python
Use the isspace() method to check if the characters in a string are all white spaces. text = ' ' print(text.isspace()) #output: True text = ' \f\n\r\t\v' print(text.isspace()) #output: True text = ' ' print(text.isspace()) #output: True text = ''…