Thanks Marc, that was very helpful.
Marc 'BlackJack' Rintsch wrote:
In [EMAIL PROTECTED], manstey wrote:
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a
Hi,
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a faster way of implementing this? Also, does the if clause
increase the speed?
Thanks,
Matthew
--
manstey schreef:
Hi,
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a faster way of implementing this? Also, does the if clause
increase the speed?
I think this is
On 06.07.2006 12:43, manstey wrote:
Hi,
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a faster way of implementing this? Also, does the if clause
increase the
But what about substitutions like:
'ab' 'cd', 'ced' 'de', etc
what is the fastest way then?
Roel Schroeven wrote:
manstey schreef:
Hi,
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data =
manstey:
is there a faster way of implementing this? Also, does the if clause
increase the speed?
I doubt the if increases the speed. The following is a bit improved
version:
# Original data:
data = 'asdfbasdf'
find = (('a', 'f'), ('s', 'g'), ('x', 'y'))
# The code:
data2 = data
for pat,rep
manstey schreef:
Roel Schroeven wrote:
manstey schreef:
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a faster way of implementing this? Also, does the if clause
In [EMAIL PROTECTED], manstey wrote:
I often have code like this:
data='asdfbasdf'
find = (('a','f')('s','g'),('x','y'))
for i in find:
if i[0] in data:
data = data.replace(i[0],i[1])
is there a faster way of implementing this? Also, does the if clause
increase the speed?
[EMAIL PROTECTED] wrote:
manstey:
is there a faster way of implementing this? Also, does the if clause
increase the speed?
I doubt the if increases the speed. The following is a bit improved
version:
# Original data:
data = 'asdfbasdf'
find = (('a', 'f'), ('s', 'g'), ('x', 'y'))
#