Python Tuples

Tuples are structures in python which are similar to lists but are immutable. They also differ in that they use () instead of [].

1
fruits = ("apples", "oranges", "kiwis")

访问元组:

要访问元组中的元素,可以使用括号表示法,就像列表一样:

1
2
3
print(f"It's like comparing ${fruits[0]} to ${fruits[1]}!")
# output:
It's like comparing apples to oranges!