- 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.
- 演進式架構(原書第2版)
- ServiceNow Application Development
- Learning AWS Lumberyard Game Development
- Learn Programming in Python with Cody Jackson
- JavaScript從入門到精通(第3版)
- Eclipse Plug-in Development:Beginner's Guide(Second Edition)
- C++程序設計基礎教程
- INSTANT Django 1.5 Application Development Starter
- 動手打造深度學習框架
- Android Sensor Programming By Example
- QlikView Unlocked
- C++17 By Example
- 虛擬現實:引領未來的人機交互革命
- 微信公眾平臺開發最佳實踐
- JavaScript編程精解(原書第3版)