- Learn Programming in Python with Cody Jackson
- Cody Jackson
- 134字
- 2021-06-10 19:06:11
Tuples
The final built-in data type is the tuple. Python tuples work exactly like Python lists except they are immutable; that is, they can't be changed in place. They are normally written inside parentheses to distinguish them from lists (which use square brackets), but as you'll see, parentheses aren't always necessary; however, a comma is always required, as expressions can use parentheses too. Since tuples are immutable, their length is fixed. To grow or shrink a tuple, a new tuple must be created.
Since parentheses can surround expressions, you have to show Python when a single item is actually a tuple by placing a comma after the item. A tuple without parentheses can be used when a tuple is unambiguous. However, it's easier to just use parentheses than to screenshot out when they're optional.
- C++面向對象程序設計(第三版)
- Practical Data Analysis Cookbook
- Spring 5企業級開發實戰
- Banana Pi Cookbook
- JavaScript動態網頁開發詳解
- SQL Server數據庫管理與開發兵書
- Python程序設計開發寶典
- Node.js從入門到精通
- TypeScript圖形渲染實戰:2D架構設計與實現
- Android技術內幕(系統卷)
- VMware vSphere 5.5 Cookbook
- Jakarta EE Cookbook
- 面向對象分析與設計(第3版)
- Switching to Angular 2
- Learning SaltStack(Second Edition)