nonunique string replacements

Ben Racine i3enhamin at gmail.com
Wed Mar 3 08:06:13 CET 2010


All,

Say I have a string "l" ...

l = 'PBUSH     201005       K      1.      1.      1.      1.      1.      1.'

And I want to replace the first "   1." with a "500.2" and the second "  1." with " 5.2" ...

What pythonic means would you all recommend?

Note the whitespace is equal between the existing substring and the replacement string.

Many thanks,
Ben Racine
i3enhamin at gmail.com






More information about the Python-list mailing list