# -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 12:52:17 2019
QQ群:476842922(欢迎加群讨论学习)
@author: Administrator
"""
import difflib
if __name__ == '__main__':
a = '123456a'
b = '234567b'
Str = '上海中心大厦上海中心大厦1'
s1 = '大厦'
s2 = '上海中心'
s3 = '上海中心大厦2'
s4 = '上海中心大厦上海中心大厦3'
print(difflib.SequenceMatcher(None, Str, s1).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s2).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s3).quick_ratio())
print(difflib.SequenceMatcher(None, Str, s4).quick_ratio())
Str = '关于报送电话的通知'
Str2 = '关于报送电话的通知1'
print(difflib.SequenceMatcher(None, Str, s1).quick_ratio())
0.26666666666666666
0.47058823529411764
0.6
0.9230769230769231