s = 'some\x00string. with\x15 funny characters'
import string
printable = set(string.printable)
[x for x in s if x in printable]
How can I remove non-ASCII characters but leave periods and spaces using Python?