Slight variation on inspectorG4dget's method - import from string
& generator comprehension:
from string import ascii_letters
allowed = set(ascii_letters + ' ')
myStr = 'happy t00 go 129.129'
answer = ''.join(l for l in myStr if l in allowed)
answer
# >>> 'happy t go '
Performance comparison:
(I made myStr a bit longer and pre-compiled the regex to make things a bit more interesting)
import re
from string import ascii_letters, digits
myStr = 'happy t00 go 129.129'*20
allowed = set(ascii_letters + ' ')
# Generator
%timeit answer = ''.join(l for l in myStr if l in allowed)
# filter/__contains__
%timeit answer = ''.join(filter(allowed.__contains__, myStr))
# Regex
pat = re.compile(r'[^a-zA-Z ]+')
%timeit answer = re.sub(pat, '', myStr)
53 µs ± 6.43 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
43.3 µs ± 7.48 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
26 µs ± 509 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)