Is there a string function to trim all non-ascii characters out of a string
Torsten Bronger
bronger at physik.rwth-aachen.de
Mon Dec 31 08:51:21 EST 2007
Hallöchen!
Paul McGuire writes:
> On Dec 31, 2:54 am, abhishek <guptaabhishek1... at gmail.com> 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>
Stupid me! How could I miss such a lovely feature in the language?
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger at jabber.org
(See http://ime.webhop.org for further contact info.)
More information about the Python-list
mailing list