Dear group:
I have two lists and I have to match the element in
the first list to element in second list and print the
line from second list:
Example:
listA =['apple','baby','cat']
listB =['fruit\tapple','tree\tapple','fruit\tmango',
'human\tbaby'
'infant\tbaby'
'human\tAl
Srinivas Iyyer wrote:
> Dear group:
>
> I have two lists and I have to match the element in
> the first list to element in second list and print the
> line from second list:
>
> Example:
> listA =['apple','baby','cat']
> listB =['fruit\tapple','tree\tapple','fruit\tmango',
> 'human\tbaby'
Hi Kent:
Thank you for your tip on making a sub-dictionary.
However, I see some new prbs. that I am unable to
solve are persisting. could you enlighten me, please.
> d={}
> for m in listB:
> cols = m.split('\t')
> term = cols[1]
> d.setdefault(term, []).append(m)
>
> for i in listA:
>
Srinivas Iyyer wrote:
> Hi Kent:
> Thank you for your tip on making a sub-dictionary.
> However, I see some new prbs. that I am unable to
> solve are persisting. could you enlighten me, please.
>
>
>>d={}
>>for m in listB:
>> cols = m.split('\t')
>> term = cols[1]
>> d.setdefault(term, []).a