On Mon, Oct 31, 2011 at 4:08 PM, Dave Angel <d...@davea.name> wrote: > I was wrong once again. But a simple combination of translate() and > split() methods might do it. Here I'm suggesting that the table replace all > valid characters with space, so the split() can use its default behavior.
That sounds overly complicated and error-prone. For instance, split() will split on vertical tab, which is not one of the characters the OP wanted. I would probably use a regular expression for this. import re if re.search(r'[^\r\n\t\040-\177]', string_to_test): print("Invalid!") Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list