python csv TypeError: unhashable type: 'list'
Question: Hi Im trying to compare two csv files and get the difference. However i get
the above mentioned error. Could someone kindly give a helping hand. Thanks

    
    
    import csv
    
    f = open('ted.csv','r')
    psv_f = csv.reader(f)
    attendees1 = []
    for row in psv_f:
    attendees1.append(row)
    
    f.close
    
    f = open('ted2.csv','r')
    psv_f = csv.reader(f)
    attendees2 = []
    for row in psv_f:
        attendees2.append(row)
    
    
    f.close
    
    attendees11 = set(attendees1)
    attendees12 = set(attendees2)
    
    print (attendees12.difference(attendees11))
    


Answer: Happened on the line

    
    
    attendees11 = set(attendees1)
    

didn't it? You are trying to make a set from a list of lists but it is
impossible because set may only contain hashable types, which list is not. You
can convert the lists to tuples.

    
    
    attendees1.append(tuple(row))
    

