Python-33陣列 List、Tuple互轉

文、意如

a=[28, 16, 39, 56, 78, 88]
print("目前a是list",a)# [28, 16, 39, 56, 78, 88]

#a轉成tuple
b=tuple(a)
print("轉成tuple後",b) #轉成tuple後 (28, 16, 39, 56, 78, 88)

#再轉成list
c=list(b)
print("轉成list後",c) #轉成list後 [28, 16, 39, 56, 78, 88]

 

Yiru@Studio - 關於我 - 意如