[Tutor] Replace sequence in list - looking for direction

GTXY20 gtxy20 at gmail.com
Mon Jun 16 17:41:25 CEST 2008


Hello all,

Thanks in advance for any thoughts, direction, and guidance.

Let's say I have a list like the following:

a = ['a1','a2','a3','a4','a5','a6']

and then I have dictionary like the following:

b = {'a1,a2,a3':'super'}

I need some direction and thoughts on how I might seach the list for the
string (the key in dict b) sequence in list a and replace the occurance with
the value from dict b. At the end I would like to have list a represented
as:

a = ['super', 'a4', 'a5', 'a6']

Thanks.

G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080616/24e44116/attachment.htm>


More information about the Tutor mailing list