1. 使用圆括号`()`直接创建元组,元素之间用逗号分隔:
```python
创建多个元组
tuple1 = (1, 2, 3)
tuple2 = ('a', 'b', 'c')
tuple3 = (True, False, True)
2. 使用`tuple()`函数将其他可迭代对象转换为元组:
```python
使用列表创建元组
list1 = [1, 2, 3]
tuple4 = tuple(list1)
使用字符串创建元组
string1 = 'abc'
tuple5 = tuple(string1)
3. 创建多个元组并存储在列表中:
```python
创建一个包含多个元组的列表
tuples_list = [
(1, 2, 3),
('a', 'b', 'c'),
(True, False, True),
[4, 5, 6],
'def',
]
以上方法可以帮助你生成多组元组。