【发布时间】:2015-11-02 12:39:43
【问题描述】:
我的代码是这样的:
text1 = "I like apple"
text2 = "I like car"
if text1 != text2:
print "the differences are:"the_difference
输出应该是:
the differences are:car
感谢阅读
【问题讨论】:
-
如果 text2 是
text2 = "An apple I like"。它应该打印the differences are: an apple吗? -
在空格上拆分两个句子,然后将一个列表与另一个列表进行比较
-
@Matheus208 这就是我的意思
-
@ZeroX 只是想知道。如果顺序很重要,那么解决方案就会不同。
-
如果正如@Matheus208 所说,那么答案可能有点困难......也许有一个模块可以做到这一点。
标签: python difference