On Jul 24, 8:47 pm, James Stroud <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I dashed off the following function to clean a string in a little
>
> program I wrote:
>
> def cleanup(astr, changes):
>for f,t in changes:
> atr = astr.replace(f, t)
>return astr
>
> where changes would be a
Peter Otten wrote:
> unicode.translate() supports this kind of replacement...
> and re.compile(...).sub() accepts a function:
Thanks Peter!
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/ma
James Stroud wrote:
> I dashed off the following function to clean a string in a little
> program I wrote:
>
> def cleanup(astr, changes):
>for f,t in changes:
> atr = astr.replace(f, t)
>return astr
>
> where changes would be a tuple, for example:
>
> changes = (
> (
Hello all,
I dashed off the following function to clean a string in a little
program I wrote:
def cleanup(astr, changes):
for f,t in changes:
atr = astr.replace(f, t)
return astr
where changes would be a tuple, for example:
changes = (
('%', '\%'),
('$',