标签:结构 list 16px code append pytho for eric bin
我们始终都要远行,最终都要与稚嫩的自己告别,告别是通向成长的苦行之路。 Hello Python - day2!
1 >>> list = [‘guanqing‘,‘wukun‘,‘lizhe‘,‘hongbing‘] 2 >>> list.append(‘qihui‘) 3 >>> list 4 [‘guanqing‘, ‘wukun‘, ‘lizhe‘, ‘hongbing‘, ‘qihui‘]
list.insert(2,‘aa‘) #增加。在列表某个位置插入元素,位置从0开始计数
1 >>> list 2 [‘guanqing‘, ‘wukun‘, ‘lizhe‘, ‘hongbing‘, ‘qihui‘] 3 >>> list.insert(2,‘eric‘) 4 >>> list 5 [‘guanqing‘, ‘wukun‘, ‘eric‘, ‘lizhe‘, ‘hongbing‘, ‘qihui‘]
1 >>> list2 = [5,3,78,5,89,1] 2 >>> max(list2) 3 89 4 >>> min(list2) 5 1 6 >>> len(list2) 7 6
1 >>> list = [‘3‘,‘6‘,‘7‘,‘9‘,‘1‘,‘22‘] 2 >>> for line in list: 3 ... print ‘Hello %s‘ % line 4 ... 5 Hello 3 6 Hello 6 7 Hello 7 8 Hello 9 9 Hello 1 10 Hello 22
标签:结构 list 16px code append pytho for eric bin
原文地址:http://www.cnblogs.com/guanqingye/p/7262909.html