A "for" with "list" question.

Sean 'Shaleh' Perry shalehperry at attbi.com
Sat Aug 31 17:44:03 EDT 2002


On Saturday 31 August 2002 14:30, Mauro wrote:
> I tried to use like this:
>
> for a in b:
>     print b[a]
>
> But it appears:
>
> 2
> 3

oddballs = []
for item in b:     # iterate over one list
    if item in a:   # test if it is in the other list
        print item
    else:
        oddballs.append(item)

for item in oddballs:
    print item




More information about the Python-list mailing list