Python容器类型转换

list1 = ['tom', 'jerry']
set1 = {'gzy', 'chris'}
tuple1 = (10, 20)

# list
# print(list(set1))
# print(list(tuple1))

# tuple
# print(tuple(list1))
# print(tuple(set1))

# set
print(set(list1))
print(set(tuple1))

posted @ 2021-03-08 18:35  code-G  阅读(72)  评论(0编辑  收藏  举报