跳至主內容區

新營學習網

This is an example of a HTML caption with a link.
:::

主內容區域

1-4 tuple

儲存容器

tuple

和陣列(List)相類似,可排列,但不能更改內容,所以比較小功快速。

t=1,2,3  
t=(1,2,3)     #兩種寫法
print(t)
print(t[2])   #結果3
a,b,c=t
print(a,b,c)
t2=(t,4,5)
print(t2)      #((1,2,3),4,5)
print(t2[0])   #(1,2,3)
t3=('x')
t4=('x',)
print('t3 type',type(t3))
print('t4 type',type(t4))
t3 type <class 'str'>
t4 type <class 'tuple'>

下中左區域內容

Google網站翻譯工具列

下中右區域內容

站內搜尋

頁尾區域