1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
from difflib import get_close_matches def get_target_match(target, targets): ''' Approximates a match for a target from a sequence of targets, if a match exists. ''' matches = get_close_matches(target, targets) print target, targets print matches return matches and matches or None target = 'z' targets = ['Joe', 'Bob', 'zombie', 'Susan', 'kobold', 'Bill'] match = get_target_match(target, targets) print "Going nom on %s" % match
You have reached a limit of free submissions this month.
You cannot send submissions this month anymore because of exceeding your monthly limit. Please recharge your account.
the submission is still running...
- upload with new input
result: Success time: 0.12s memory: 11640 kB returned value: 0
z ['Joe', 'Bob', 'zombie', 'Susan', 'kobold', 'Bill']  Going nom on None