Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread [EMAIL PROTECTED]
Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only ascii characters? Thank you. -- http://mail.python.org/mailman

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Dan Bishop
On Dec 31, 2:20 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread abhishek
On Dec 31, 1:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread John Machin
On Dec 31, 7:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread John Machin
On Dec 31, 7:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Paul McGuire
On Dec 31, 2:54 am, abhishek [EMAIL PROTECTED] wrote: Use this function -- def omitNonAscii(nstr):     sstr=''     for r in nstr:         if ord(r)127:             sstr+=r     return sstr Yoda Learn the ways of the generator expression you must. /Yoda See Dan Bishop's post. -- Paul --

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Duncan Booth
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only ascii characters

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Steven D'Aprano
On Mon, 31 Dec 2007 01:09:09 -0800, John Machin wrote: On Dec 31, 7:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread John Machin
On Dec 31, 7:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Michael Ströder
[EMAIL PROTECTED] wrote: Is there a string function to trim all non-ascii characters out of a string? Let say I have a string in python (which is utf8 encoded), is there a python function which I can convert that to a string which composed of only ascii characters? I'd recommend to rethink

Re: Is there a string function to trim all non-ascii characters out of a string

2007-12-31 Thread Torsten Bronger
Hallöchen! Paul McGuire writes: On Dec 31, 2:54 am, abhishek [EMAIL PROTECTED] wrote: Use this function -- def omitNonAscii(nstr):     sstr=''     for r in nstr:         if ord(r)127:             sstr+=r     return sstr Yoda Learn the ways of the generator expression you must.