python 列表转元组

时间:2024-10-12 17:21:01

1、创建列表。

python 列表转元组

2、使用tuple()函数将列表转化为元组。

python 列表转元组

3、打印输出转换后的元组。

python 列表转元组

4、尝试修改元组。

python 列表转元组

5、发现修改失败并抛出TypeError异常,元组是不可变的。

python 列表转元组
© 2025 长短途
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com