[Tutor] Finding a part of an element in a list

kumar s ps_python at yahoo.com
Mon Dec 6 18:57:11 CET 2004

Dear Group, 

I have a list that is:

List1 =

In other list I have :
List2= ['Corolla','Accord','Camry']

I want to see if Corolla is there in list 1:

The code:
for i in range(len(List1)):
     if i in range(len(List2):
          print i

If I have 'Corolla' as an element in both list then it
is easy to find.  However, in List1 this element
appears as 'Model=Toyota_Corolla'. 

How can I ask python to match both elements:
'Model=Toyota_Corolla' and 'Corolla', where a part of
element is matching. 

please help.


Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!

More information about the Tutor mailing list