aa=frozenset([‘warning‘,‘baba‘])
bb=frozenset(‘warning‘)
print aa
print bb
if "baba" in aa:
print "1# yes"
if ‘baba‘ in aa:
print "2# yes"
if ‘waring‘ in bb:
print "3# yes"
if ‘w‘ in bb:
print "4# yes"
结果:
frozenset([‘baba‘, ‘warning‘])
frozenset([‘a‘, ‘g‘, ‘i‘, ‘n‘, ‘r‘, ‘w‘])
1# yes
2# yes
4# yes
时间: 2024-10-08 08:16:49