雪让人的觉得只有一个字——冷。大地一片银白,一片清洁,而雪花仍如柳絮,如棉花,如鹅毛从天空飘飘洒洒。
本文实例简单讲述了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程序设计有所帮助。
以上就是python中sets模块的用法实例。要想自己变得更强盛,独一的措施只有努力、努力、再尽力。更多关于python中sets模块的用法实例请关注haodaima.com其它相关文章!