ascii character - removing chars from string

Simon Forman rogue_pedro at yahoo.com
Mon Jul 3 20:47:23 EDT 2006


bruce wrote:
> hi...
>
> i'm running into a problem where i'm seeing non-ascii chars in the parsing
> i'm doing. in looking through various docs, i can't find functions to
> remove/restrict strings to valid ascii chars.
>
> i'm assuming python has something like
>
> valid_str = strip(invalid_str)
>
> where 'strip' removes/strips out the invalid chars...
>
> any ideas/thoughts/pointers...
>
> thanks
>
> -bruce

You might be able to use the translate() and maketrans() string
methods.  See
http://groups.google.ca/group/comp.lang.python/tree/browse_frm/thread/261516dd06ee32e6/9a02a21c95bd0ec9
second-to-last post for an example.




More information about the Python-list mailing list