Replacing Periods with Backspaces

Aahz aahz at
Fri Apr 9 11:22:11 EDT 2010

In article <8404fac9-06c7-4555-93af-c78f5e01d730 at>,
Booter  <colo.avs96 at> wrote:
>I am trying to replace a series of periods in a sting with backspaces
>that way I can easily parse information from a Windows command.  the
>current statement I have for this is
>capture = re.sub('\.*', '\b', capture)

What's wrong with 

capture = capture.replace('.', '\b')

That will be much faster.
Aahz (aahz at           <*>

"...string iteration isn't about treating strings as sequences of strings, 
it's about treating strings as sequences of characters.  The fact that
characters are also strings is the reason we have problems, but characters 
are strings for other good reasons."  --Aahz

More information about the Python-list mailing list