Parsing string array for differences

Ray Slakinski kier at sdf1.net
Mon Apr 12 12:56:21 EDT 2004


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



More information about the Python-list mailing list