Using s at any point in the pattern string matches a whitespace character. This is more general then the space character, as it applies to tabs and newline characters:
....
a_space_b = re.compile("asb")
if a_space_b.search("a b"):
print("'a b' is a match!")
if a_space_b.search("1234 a b 1234"):
print("'1234 a b 1234' is a match")
if a_space_b.search("ab"):
print("'1234 a b 1234' is a match")