首页 > 其他 > 详细

sh_06_元组基本使用

时间:2019-09-14 16:28:51      阅读:54      评论:0      收藏:0      [点我收藏+]

 

sh_06_元组基本使用

info_tuple = ("zhangsan", 18, 1.75, "zhangsan")

# 1. 取值和取索引
print(info_tuple[0])
# 已经知道数据的内容,希望知道该数据在元组中的索引
print(info_tuple.index("zhangsan"))

# 2. 统计计数
print(info_tuple.count("zhangsan"))
# 统计元组中包含元素的个数
print(len(info_tuple))

 

sh_06_元组基本使用

原文:https://www.cnblogs.com/shaohan/p/11519349.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!