使用python怎么实现查找两个字符串中相同字符?
大神,求带!
大神,求带! 2017-02-04 11:06:05
0
2
1243

使用python怎么实现查找两个字符串中相同字符?

大神,求带!
大神,求带!

reply all(2)
数据分析师

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.

伊谢尔伦

具体示例代码如下:

seq1 = "spam" 
seq2 = "scam" 
res = []
for x in seq1:
  if x in seq2:
    res.append(x)
print res

输出结果如下:

['s', 'a', 'm']


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template