Python中元组的基本用法

 1 """ Python中元组的基本用法 """
 2 
 3 # del tup:删除元组(元组中的元素是不允许删除的,但可以使用del删除整个元组)
 4 tup = ('Google', 'Runoob')
 5 del tup
 6 print(tup)
 7 
 8 # tuple(seq)将列表转换为元组
 9 seq = ["语文", "数学", "英语"]
10 tup = tuple(seq)
11 print(tup)
Python中元组的基本用法

猜你喜欢

转载自www.cnblogs.com/Junlong/p/11391413.html
今日推荐