Pythonのタプル、リストの違い
listはいわゆる配列。 tuple(タプル) は、変更できないlist。
list = ['a', 'b', 'c'] print list[0] # 出力 : a tuple = ['a', 'b', 'c'] print tuple[0] # 出力 : a list[1] = 'E' tuple[1] = 'E' # エラーが出る
listはいわゆる配列。 tuple(タプル) は、変更できないlist。
list = ['a', 'b', 'c'] print list[0] # 出力 : a tuple = ['a', 'b', 'c'] print tuple[0] # 出力 : a list[1] = 'E' tuple[1] = 'E' # エラーが出る