Use difflib.get_close_matches
.
>>> words = ['hello', 'Hallo', 'hi', 'house', 'key', 'screen', 'hallo', 'question', 'format']
>>> difflib.get_close_matches('Hello', words)
['hello', 'Hallo', 'hallo']
Please look at the documentation, because the function returns 3 or less closest matches by default.
More Related Contents:
- What does += mean in this context?
- Most efficient way to build single-element list from string with or without spaces? [closed]
- User input integer list [duplicate]
- How to split a string into a list of characters?
- How to convert list to string [duplicate]
- Pythonic way to check if a list is sorted or not
- How would you make a comma-separated string from a list of strings?
- Find common substring between two strings
- Converting a String to a List of Words?
- Is the time-complexity of iterative string append actually O(n^2), or O(n)?
- String to list in Python
- case-insensitive list sorting, without lowercasing the result?
- How do I convert a list into a string with spaces in Python?
- Perform a string operation for every element in a Python list
- How do I serialize a Python dictionary into a string, and then back to a dictionary?
- How to convert a string of space- and comma- separated numbers into a list of int? [duplicate]
- Change a string of integers separated by spaces to a list of int
- How to convert a string list into an integer in python [duplicate]
- Convert list of strings to dictionary
- Sort list of strings by a part of the string
- How to create a list with the characters of a string? [duplicate]
- Python: How to check a string for substrings from a list? [duplicate]
- convert a string which is a list into a proper list python
- How to split an iterable into two lists with alternating elements
- How can I match up permutations of a long list with a shorter list (according to the length of the shorter list)? [duplicate]
- split string in python to get one value?
- How to sort a list of strings in reverse order without using reverse=True parameter?
- How to convert list of intable strings to int [duplicate]
- Join a list of strings in python and wrap each string in quotation marks
- Find non-common elements in lists