python 对比两个字符串相似度

import difflib

def get_equal_rate(str1, str2):
return difflib.SequenceMatcher(None, str1, str2).quick_ratio()

if __name__ == '__main__':
print(get_equal_rate('武汉肺炎', '中肺炎武汉'))

猜你喜欢

转载自www.cnblogs.com/zhangjian0092/p/12331068.html