【Python】tuple and list 练习
2017-07-06 14:53
411 查看
Tuple:
1. __add__
1 a = (1,2,3,4,5,6,7,8,9,) 2 b = (10,11,22,33,44,55,66,), 3 c = (110,112,113,114,), 4 result = a.__add__(b) 5 print(result) #(1, 2, 3, 4, 5, 6, 7, 8, 9, (10, 11, 22, 33, 44, 55, 66)) add(b)里面只能加一个参数,否则会报错 6 print(a+b+c) #(1, 2, 3, 4, 5, 6, 7, 8, 9, (10, 11, 22, 33, 44, 55, 66), (110, 112, 113, 114))
1 a = (1,2,3,4,5,6,7,8,9,) 2 b = (10,11,22,33,44,55,66,) 3 c = (110,112,113,114,) 4 result = a.__add__(b) 5 print(result) #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22, 33, 44, 5, 66) 有没有逗号的区别哈哈 6 print(a+b+c) #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 22, 33, 44, 55, 66, 110, 112, 113, 114)
相关文章推荐
- Python练习-- list and tuple
- Python-list and tuple
- Python 学习笔记(二):List and Tuple
- python中的cm()len() list() and tuple()以及一些内建函数
- The study of list ,tuple and conditional statement in Python(20170905)
- Why we have tuple and list in python
- Python的list和tuple小练习
- Python list and tuple
- Python中的List,Tuple和Dictionary
- python31初级[list+tuple+set+dict+str+file的成员方法]
- python练习之读取文件,list,hash
- Python list dic tuple string
- python中tuple构成的list的排序
- Python list、tuple、dict区别
- python的dict,set,list,tuple应用
- python 集合类型 tuple 与 list
- Python中list、tuple、dict区别
- python学习笔记——列表(list)和元组(tuple)
- python的list,dict,tuple比较和应用
- python 学习记录(8)-tuple/list/dictionary/sequence