[Python] Python输出两个字符串中相同的字符 →→→→→进入此内容的聊天室

来自 , 2020-11-24, 写在 Python, 查看 156 次.
URL http://www.code666.cn/view/8cfef17b
  1. import sets
  2. magic_chars = sets.Set('abracadabra')
  3. poppins_chars = sets.Set('supercalifragilisticexpialidocious')
  4. print ''.join(magic_chars & poppins_chars) # 集合的交集
  5.  
  6.  

回复 "Python输出两个字符串中相同的字符"

这儿你可以回复上面这条便签

captcha