hi... update. i'm getting back html, and i'm getting strings like " foo " which is valid HTML as the ' ' is a space.
i need a way of stripping/removing the ' ' from the string the needs to be treated as a single char... text = "foo cat " ie ok_text = strip(text) ok_text = "foo cat" thanks -bruce -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Rune Strand Sent: Monday, July 03, 2006 5:43 PM To: python-list@python.org Subject: Re: ascii character - removing chars from string 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... If you're able to define the invalid_chars, the most convenient is probably to use the strip() method: >>> a_string = "abcdef" >>> invalid_chars = 'abc' >>> a_string.strip(invalid_chars) 'def' -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list