Re: Is there a string function to trim all non-ascii characters out of a string
- From: John Machin <sjmachin@xxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 03:30:00 -0800 (PST)
On Dec 31, 7:20 pm, "silverburgh.me...@xxxxxxxxx"
<silverburgh.me...@xxxxxxxxx> 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?
You actually asked TWO different questions, and have got answers
mainly to the first one. Here's a very simple answer to the second
question, which has the advantage of no loss of information:
repr(your_utf8_string.decode('utf8'))
or merely
repr(your_utf8_string)
Cheers,
John
.
- References:
- Is there a string function to trim all non-ascii characters out of a string
- From: silverburgh.meryl@xxxxxxxxx
- Is there a string function to trim all non-ascii characters out of a string
- Prev by Date: Re: at what complexity, a comparison fails ?
- Next by Date: Re: TK 8.5
- Previous by thread: Re: Is there a string function to trim all non-ascii characters out of a string
- Next by thread: Re: Is there a string function to trim all non-ascii characters out of a string
- Index(es):
Relevant Pages
|