在Python中,你可以使用元组(tuple)或列表(list)来定义一个变量的多个值。
使用元组:
```python
x = (1, 2, 3)
```
使用列表:
```python
x = [1, 2, 3]
```
在使用元组或列表时,你可以通过索引来访问其中的值。例如,要访问元组或列表的第一个值,可以使用索引0:
```python
print(x[0]) # 输出为 1
```
请注意,元组和列表的主要区别在于元组是不可变的,而列表是可变的。如果你需要修改其中的值,应该使用列表。
class Test: pass a = Test() for xx in range(97, 123): t = chr(xx) + '=Test()' print t exec(t) print eval(chr(xx)
) print a print z