1. 字段入库(重复字高的,不做新纪录)

# 将重复率3个字的值,累加次数,不再新纪录
def check(text1,text2,dis=3):
    DIS = 0
    for i in text1:
        if i in text2:
            DIS += 1
            if DIS >= dis: return True
    return False

_dict = {}
def save(text):
    for key in _dict.keys():
        if check(text,key):
            _dict[key] += 1
            return '已经存在'
    _dict[text] = 1
    return f'新增:{text}'

save('机器')
save('机器故障')
save('机器故障问题')
print(_dict)
Copyright © 2021 zbmain.  all right reserved,powered by Gitbook本页修订时间: 2021-04-10

results matching ""

    No results matching ""