Reputation: 1511
Could you guys help? Thanks!
Upvotes: 2
Views: 382
Reputation: 363516
>>> mylist = ['ham and eggs', 'spam and legs', "it's time to die, mr bond!"]
>>> import difflib
>>> close_matches = difflib.get_close_matches('spam and eggs', mylist)
>>> close_matches
['spam and legs', 'ham and eggs']
>>> set(mylist) - set(close_matches)
set(["it's time to die, mr bond!"])
Upvotes: 4