Home >Backend Development >Python Tutorial >Module 'thefuzz' has no attribute 'partial_ratio' and other strange errors
Have been trying to use thefuzz to compare two different lists and got the above error, which doesn't seem right. I've commented out everything else in the code except the two test lines below, but I still get the error. I also tried fuzz.ratio, fuzz.token_sort_ratio and fuzz.token_set_ratio, but got an error every time.
import thefuzz as fuzz fuzz.partial_ratio("fuzzy was a bear", "wuzzy fuzzy was a bear")
You want
import thefuzz.fuzz as fuzz
or
from thefuzz import fuzz
Because this is where the functionality you want
Usage section of thefuzz readme file (https://github.com/seatgeek/thefuzz/blob/master/readme .rst) Suggestions:
from thefuzz import fuzz from thefuzz import process
The above is the detailed content of Module 'thefuzz' has no attribute 'partial_ratio' and other strange errors. For more information, please follow other related articles on the PHP Chinese website!