python求字符串的交集和并集
参考来源#!/usr/bin/pythonimport setsmagic_char = sets.Set('abcde')poppins_chars = sets.Set('bdxyz')print ''.join(magic_char & poppins_chars)#InterSectionprint ''.join(magic_char | poppins_chars)#
·
参考来源
#!/usr/bin/python
import sets
magic_char = sets.Set('abcde')
poppins_chars = sets.Set('bdxyz')
print ''.join(magic_char & poppins_chars) #InterSection
print ''.join(magic_char | poppins_chars) #Union
更多推荐
已为社区贡献1条内容
所有评论(0)