Python中的元組和列表的區別
python中元組用小括號而列表用中括號。
但是元組不能修改值。
實驗程式碼如下:
a=(1,3,4,2)
b=[1,2,3,4]
b[1]=5
print(b)
a[1]=5
print(a)
實驗結果:
[1, 5, 3, 4]
a[1]=5
TypeError: 'tuple' object does not support item assignment
相關文章
- python中的列表和元組有什麼區別Python
- 總結python 元組和列表的區別Python
- Python 列表和元組的區別是什麼?Python
- Python之列表與元組的區別詳解Python
- Python的元組和列表Python
- Python中列表、元組、字典有何區別?Python學習!Python
- python元組和列表Python
- Python中元組,列表,字典的區別Python
- python列表元組的操作Python
- list和tuple元組的區別
- python內建資料型別:列表和元組Python資料型別
- python資料型別 列表+元組Python資料型別
- 三、python的資料型別 列表、元組、字典Python資料型別
- python list(列表)和tuple(元組)Python
- Python列表、元組、集合、字典的區別是什麼?入門知識!Python
- 資料型別· 第1篇《元組和列表的效能分析、命名元組》資料型別
- python基礎之序列型別的方法——列表&元組Python型別
- Python3中列表方法append()和extend()的區別PythonAPP
- Python中列表遍歷使用range和enumerate的區別Python
- python列表(list)和元組(tuple)詳解Python
- python如何返回元組,列表或字典的?Python
- python元組、列表的異同總結Python
- 013:列表和元組的應用
- Python列表、元組、字典使用Python
- Python 中 is 和 == 的區別Python
- Python中is和==的區別Python
- 【美妙的Python之五】變數:列表、元組、元字典Python變數
- Python標準型別的比較原則:字典VS列表(元組)Python型別
- 【Python】(六)Python資料型別-列表和元組,九淺一深,用得到Python資料型別
- Python基礎:資料型別-列表與元組(6)Python資料型別
- Python 元組,不可變的列表,滾雪球學 PythonPython
- Python陣列和列表的區別?Python學習教程Python陣列
- python_列表——元組——字典——集合Python
- Python 學習之元組列表Python
- python list列表基礎(元組)Python
- Python之列表&元組小練Python
- python基礎之元組,列表Python
- Python元組、列表、集合及列表去重操作Python