蟒蛇如果串具有空间
In [1]: import re
In [2]: string = "Hello world"
In [3]: bool(re.search('\s', string))
Out[3]: True
In [4]: string = "World"
In [5]: bool(re.search('\s', string))
Out[5]: False
如何检查,如果一个字符串中包含空间蟒蛇
#isspace() is a built-in method used for string handling
string = "My name is"
print(string.isspace())
#It will print True
string = "Hello"
print(string.isspace())
#It will print True