import re string = ' and are escape sequences.' result = re.findall(r'[ ]', string) print(result) # Output: [' ', ' ']