赵走x博客
网站访问量:151502
首页
书籍
软件
工具
古诗词
搜索
登录
24、nonlocal
23、Python functools.wraps 深入理解
21、Image.rotate旋转90度图片被截取了
20、python的__get__方法看这一篇就足够了
19、结巴分词(自然语言处理之中文分词器)
18、virtualenv
17、Python string 去掉标点符号 最佳实践
16、python 字符串相似度
15、StringIO和BytesIO
14、基于Python __dict__与dir()的区别详解
13、 set()去重的底层原理
12、顺序表的原理与python中的list类型
11、psutil实现系统监控
10、NSQ
9、utf-8的中文是一个汉字占三个字节长度吗?
8、supervisor+gunicorn部署python web项目
7、socket编程
6、async
5、Python的共享经济
4、Python 内存分配时的小秘密
3、Python中的“特权种族”是什么?
2、装饰器
1、序列化与反序列化
16、python 字符串相似度
资源编号:76592
Python
Python 查缺补漏
热度:102
参考:https://blog.csdn.net/Disany/article/details/82768328
利用difflib模块—实现两个字符串或文本相似度比较 首先导入difflib模块 ```python import difflib ``` 示例: ```python Str = '上海中心大厦' s1 = '大厦' s2 = '上海中心' s3 = '上海中心大楼' print(difflib.SequenceMatcher(None, Str, s1).quick_ratio()) print(difflib.SequenceMatcher(None, Str, s2).quick_ratio()) print(difflib.SequenceMatcher(None, Str, s3).quick_ratio()) ``` 结果: ``` 0.5 0.8 0.8333333333333334 ```