Re: simple string backspace question
- From: "Diez B. Roggisch" <deets@xxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 12:37:07 +0200
vedrandekovic@xxxxxxxxxxxxxx wrote:
On 31 srp, 12:03, ra...@xxxxxxx (Lawrence Oluyede) wrote:
<vedrandeko...@xxxxxxxxxxxxxx> wrote:
If you mean on operating system then unfortunately Windows XP.
I don't know for sure but maybe it doesn't support all ASCII escapes
codes.
Why do you care about \b anyway :-) ?
--
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair
Hi,
I need this inevitable for my "programming language", for code
indentation. I don't know how to write script with module tokenize
for code indentation.
Still not giving up reinventing the wheel? You should take some lessons on
syntax analysis before attempting this. But I know this words won't be
heard...
So, to your actual problem: that backspace is removing a character is
something an editor or a terminal do, because they interpret the backspace.
You wouldn't expect the string "<font color="blue">foo</font>" to be
rendered blue by magic as well, wouldn't you?
So what you need to do is: search the string for backspaces, and remove the
BS as well as the character before. Something along these lines (untested):
teststring = "abc\bcde\b"
while teststring.find("\b") > -1:
pos = teststring.find("\b")
teststring = teststring[:pos-1] + teststring[pos+1:]
Diez
.
- References:
- simple string backspace question
- From: vedrandekovic
- Re: simple string backspace question
- From: vedrandekovic
- Re: simple string backspace question
- From: Lawrence Oluyede
- Re: simple string backspace question
- From: vedrandekovic
- simple string backspace question
- Prev by Date: Re: win32 question in Python
- Next by Date: Re: Simple question about logging module.
- Previous by thread: Re: simple string backspace question
- Next by thread: Re: simple string backspace question
- Index(es):
Relevant Pages
|