Frank Niessink wrote:
> Scott David Daniels wrote:
>> Frank Niessink wrote:
>>> - What is the easiest/most pythonic (preferably build-in) way of 
>>> checking a unicode string for control characters and weeding those 
>>> characters out?
>>      drop_controls = [None] * 0x20
>>      for c in '\t\r\n':
>>          drop_controls[c] = unichr(c)
>>      ...
>>      some_unicode_string = some_unicode_string.translate(drop_controls)
> 
> Your code gave me a "TypeError: an integer is required"....

Sorry about that.
 >>          drop_controls[c] = unichr(c)
should have been:
 >>          drop_controls[ord(c)] = unichr(c)

-- 
-Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to