
Python3 元组数据类型
文章平均质量分 80
鵬哥仔
有评论或者提问题看到会认真回复,持续写作中
展开
-
【Python3】列表的基本操作
追加列表master_heros = [‘王昭君’, ‘女娲’, ‘安其拉’, ‘米莱迪’]master_heros.append(‘武则天’)print('追加列表: ', master_heros)清空列表master_heros.clear()print(‘清空列表:’, master_heros)复制列表shooter_heros = [‘后裔’, ‘李元芳’, ‘鲁班’, ‘狄仁杰’]y = shooter_heros.copy()print(‘复制列表:’, y)查列表字符原创 2021-12-09 17:56:24 · 326 阅读 · 0 评论 -
【Pthon3:元组】
元组的基本操作:元组定义tup1 = (‘Google’, ‘Runoob’, 1997, 2000)tup2 = (1, 2, 3, 4, 5, 6, 7)tup3 = “a”, “b”, “c”, “d” # 不需要括号也可以tup4 = () # 创建空元组tup5 = (50,) # 包含一个元素需要后面加逗号 <class ‘tuple’>tup6 = (50) # <class ‘int’>访问元组print("tup1[0]: ", tup1[原创 2021-12-03 17:00:52 · 516 阅读 · 0 评论