python 集合解析


# 生成元组集合
tmp = {(x, x+1) for x in range(10)}
print(type(tmp))
print(tmp)

# 生成列表集合
tmp = {[x] for x in range(10)}
print(tmp)

猜你喜欢

转载自www.cnblogs.com/lizitest/p/9553615.html
今日推荐