在python中对集合进行遍历的方法有以下两种
1.使用for循环对集合进行遍历
A = {'1','2','star'}
for item in A:
print(item,end='')
2.使用while对集合进行循环遍历
A = {'1','2','star'}
try:
while True:
print(A.pop(),end='')
except:
pass
Copyright © 2013-2021 xieniao.com. 血鸟 版权所有 景德镇送码科技有限公司 赣ICP备19014045号-2
增值电信业务许可证:赣B2-20200002 赣公网安备 36020302000062号