python if string is null or whitespace

Solutions on MaxInterview for python if string is null or whitespace by the best coders in the world

showing results for - "python if string is null or whitespace"
Catarina
29 Aug 2017
1def IsNullOrEmpty(x): # Returns true if null or empty
2    nullorempty = False
3    
4    if not(x): 		# checks for nulls
5        nullorempty = True
6    if x.isspace(): # checks for blank strings
7        nullorempty = True    
8        
9    return nullorempty