Removing Control characters

Bjorn Pettersen BPettersen at
Mon Jan 6 18:37:16 CET 2003

> From: Amol Sonaikar [mailto:amol at] 
> In your reply below you have used chr(8) to identify ^H. Can 
> I use same 
> function chr(8) in if statement
> Currently I am getting following error. What can be the correct syntax
>     if str1[i] == chr(8)
>                        ^
> SyntaxError: invalid syntax

You're missing the colon at the end of the line. If you want, you can
probably file a bug report on SourceForge that the error message isn't
very beginner friendly...
(, you'll need
to create a user and/or log in before you can file bugs).

-- bjorn

More information about the Python-list mailing list