On Jan 21, 7:08 pm, John Machin <sjmac...@lexicon.net> wrote: > > To replace non-ASCII characters in a UTF-8-encoded string by spaces: > | >>> u8 = ' and 25\xc2\xb0F' > | >>> u = u8.decode('utf8') > | >>> ''.join([chr(ord(c)) if c <= u'\x7f' else ' ' for c in u]) > | ' and 25 F'
Thanks John for your reply. This is what I needed. Cheers, Gaurav -- http://mail.python.org/mailman/listinfo/python-list