Removing everything except letters and spaces from string in Python3.3

python, python-3.3, regex, translate

Solution

whitelist = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ')
myStr = "happy t00 go 129.129$%^&*("
answer = ''.join(filter(whitelist.__contains__, myStr))

Output:

>>> answer
'happy t go '

Problem

I have this example string: `happy t00 go 129.129` and I want to keep only the spaces and letters. All I have been able to come up with so far that is pretty efficient is: ``` print(re.sub("\d", "", 'happy t00 go 129.129'.replace('.', ''))) ``` but it is only specific to my example string. How can remove all characters other than letters and spaces?

Original source