# 元組。關鍵字:tuple# 定義好了,就不可以修改。只能讀。數據之間全部都是用,隔開。# 定義:()my_tuple = () # 空元組my_tuple2 = ("xj","female",18,170)# 定義方式二my_tuple3 = "hello","python","class17" ...
# 元組。關鍵字:tuple
# 定義好了,就不可以修改。只能讀。數據之間全部都是用,隔開。
# 定義:()
my_tuple = () # 空元組
my_tuple2 = ("xj","female",18,170)
# 定義方式二
my_tuple3 = "hello","python","class17"
print(my_tuple3)
# 讀取,索引 從0開始 元組變數名[索引]
print(my_tuple2[1])
# 元組只有一個數據的時候,要加,
my_tuple4 = ("hello",)
# 元組中儘量不要保存可變類型(list、dict)的數據