Parsing string array for differences

Tim Daneliuk tundra at tundraware.com
Mon Apr 12 13:10:07 EDT 2004


Ray Slakinski wrote:
> My below code doesn't do what I need it to do.  What I want is to
> capture the differences between two arrays of data into a new list. 
> So if list A has {Fred, Bob, Jim} and List B has {Jim, George, Fred} I
> want to capture in list C just {Fred, Jim}
> 
> y = 0        
> z = 0
> data = {}
> for element in listB:                
>    x = 0                
>    for element in listA:                        
>       if listA[x] != listB[y]:                                
>          listC[z] = listB[y]
>          z = z + 1                      
>       x = x +1                
> y = y + 1
> 
> Any and all help would be /greatly/ appreciated!
> 
> Ray

http://pydoc.org/2.3/sets.html

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list