dev-cheats / comments

站点评论仓库
0 stars 1 forks source link

Python 基础之元组数据类型 | 开发者秘籍_开发者提升 #96

Open hellokaton opened 6 years ago

hellokaton commented 6 years ago

https://dev-cheats.com/python-full-stack/tuple-data-type.html

元组(tuple)和列表的为唯一区别就是列表可以更改,元组不可以更改,其他功能与列表一样 创建元组的两种方法 第一种 ages = (11, 22, 33, 44, 55) 第二种 ages = tuple((11, 22, 33, 44, 55)) 如果元祖内只有一个元素,那么需要加上一个逗号,否则就变成字符串了。