[Tutor] Regular expression
Shitiz Bansal
shitizb at yahoo.com
Thu Oct 7 23:46:36 CEST 2004
Its simple enough.
from string import *
s= [AKT|PI3K][RHOA|BCL:CDC42:IKK:RAC1:RAL:RALBP1]
d=split(s,'][')
gives:
d[0]=[AKT|PI3K
d[1]=RHOA|BCL:CDC42:IKK:RAC1:RAL:RALBP1]
now remove the first and last character from d[0] and d[last]
after that split(d[n],'|')
and so on..
kumar s <ps_python at yahoo.com> wrote:
Dear group,
I have a string that looks like this:
[AKT|PI3K][RHOA|BCL:CDC42:IKK:RAC1:RAL:RALBP1]
I wanted to make the stuff that is enclosed in [] as
an element in a dictionary.
something like this:
a = {
'AKT': 'PI3K';
'RHOA: 'BCL','CDC42','IKK','RAC1','RAL',RALBP1
}
my main of this exrcise is to write a script that will
take this input and write to a file the following
format:
digraph a {
PI3K -> AKT;
BCL -> RHOA;
CDC42 -> RHOA;
IKK -> RHOA;
RAC1 -> RHOA;
RAL -> RHOA;
RALBP1 -> RHOA;
}
I wante to use a reg. exp and trap stuff in between []
into a list or a dictionary. and then write elements
in to the following format.
Any help please.
thanks
Kumar.
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041007/5dacee7e/attachment.html
More information about the Tutor
mailing list