i want to calculate the percent of similarity between two lists as an example if i have two list that describe book attribute list1(author, brand , isbn, category, amount) lis开发者_运维技巧t2(author , price , brand) i saw this function similarity= n/m where n is the number of matched concepts and m is the smaller cardinality of two lists i dont know if it is correct i see that m must be the list with more number of concepts do you agree me??
The Python standard library has a class called difflib.SequenceMatcher
that can compute this degree of similarity for any two lists.
精彩评论