【发布时间】:2020-05-13 05:05:57
【问题描述】:
我想编写一个代码来比较两个文本并告诉我一些相同的字符(或一些相同的单词) 我怎样才能做到这一点? 我不想用:
print(text1 == text2)
我除了:
a = "i from israel"
b = "hello i from london"
# *i* and *from* are in both strings = 2
c = "apple orange banana watermelon"
d = "apple is very healthy, also banana and orange"
# *apple* and *banana* and *orange* are in both strings = 3
我想与低加重度进行比较,我的意思是,计算两个字符串中的单词。 谢谢
【问题讨论】:
-
您期望的输入和输出示例是什么?
-
另外,到目前为止,您尝试了哪些代码?而“低加重”是什么意思?
标签: python-3.x string compare python-textprocessing