当前位置: 移动技术网 > IT编程>脚本编程>Python > python中sets模块的用法实例

python中sets模块的用法实例

2019年03月25日  | 移动技术网IT编程  | 我要评论

塘峡口冷烟低,优美伤感的文章,恶妃欲孽

本文实例简单讲述了python中sets模块的用法,分享给大家供大家参考。

具体方法如下:

import sets 
magic_chars = sets.set('abracadabra') 
print magic_chars 
poping_chars = sets.set('supercalifragilisticeexpialidocious') 
print poping_chars 
print "".join(magic_chars & poping_chars)

程序运行结果如下:

set(['a', 'r', 'b', 'c', 'd'])
set(['a', 'c', 'e', 'd', 'g', 'f', 'i', 'l', 'o', 'p', 's', 'r', 'u', 't', 'x'])
acrd

希望本文所述对大家的python程序设计有所帮助。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网