On Tue, Sep 27, 2016 at 03:46:25AM +0530, srinivas devaki wrote:
> How can I convert Unicode to Ascii by stripping of any non ascii characters.
>
> one way is to filter on s like
>
> ascii = ''.join(filter(lambda x: 0 <= ord(x) < 256, unicode_string))
>
> but are there any other simple ways ?
See also my reply to Bruce just now, but the easiest way is to encode to
bytes, then back to text:
ascii = unicode_string.encode('ascii', 'ignore').decode('ascii')
--
Steve
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor