I'm very new to Python. I need to compare two lists of words and detect those words in one list which are not in the other. Here are two test files
big_list.txt
[coin, co-operate, accurate, achieve, adapt, adjust, admire, admission, enter, advance, adventure, aeroplane, plane, affair, aim, objective, annual, approach, approve, argument]
small_list.txt
[coin, co-operate, football, accurate, achieve, adapt, amazing, adjust, admire, admission, enter, advance, breakfast]
with this expected output
[football, amazing, breakfast]
I have a pretty simple Python script here
from sys import argv
big_list, small_list = argv
blist = open(big_list).read()
slist = open(small_list).read()
dlist = [item for item in slist if item not in blist]
diff_list = open(dlist, 'w').write()
diff_list.close()
but when run it returns this error message
roy@medea:~/e2tw/list_comparison$ python file_comp1.py big_list.txt small_list.txt
Traceback (most recent call last):
File "file_comp1.py", line 3, in <module>
big_list, small_list = argv
ValueError: too many values to unpack