数据分析师2017-10-01 00:00:36
How to use python to find the same characters in two strings? -PHP Chinese website Q&A-How to use python to find the same characters in two strings? -PHP Chinese website Q&A
Let’s take a look and learn.
伊谢尔伦2017-02-04 11:07:47
具体示例代码如下:
seq1 = "spam" seq2 = "scam" res = [] for x in seq1: if x in seq2: res.append(x) print res
输出结果如下:
['s', 'a', 'm']