> How do I detect non-ascii letters in a string? I want to detect the > condition that a string have a letter that is not here: > string.ascii_letters
I don't know how efficient it is, but it's fairly clean: clean_string = ''.join([c for c in some_string if c in string.ascii_letters]) If you just want to do the detection, you can do if [c for c in some_string if c not in string.ascii_letters]: print "hey, something's bogus!" else: print "doing stuff with a the valid string %s" % some_string which takes advantage of the fact that an empty list is considered a False condition. -tkc -- http://mail.python.org/mailman/listinfo/python-list