demo_regex_search.py:
import re str = "The rain in Spain" x = re.search("\s", str) print("The first white-space character is located in position:", x.start())
➜ begtut>python demo_regex_search.py
The first white-space character is located in position: 3