python元组,集合

######元组####### 1.tuple为什么需要元组? 比如:打印用户的姓名 userinfo1 = "fentiao 4 male" userinfo[0:7] 结论:字符串中操作提取姓名/年龄/性别的方式不方便,诞生元组. 2.元组的定义 •- 定义空元组 tuple = () •- 定义单个值的元组 tuple = (fentiao,) •- 一般的元组 tuple = (fenti
相关文章
相关标签/搜索