xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
def space(text):
if ' ' in text:
return True
else: return False
xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
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
xxxxxxxxxx
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