期货仓差是什么意思,中央三台星光大道,4333小游戏
上一篇:
>>> list(map(lambda x:x**2,range(23))) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484]
>>> test=[ x**2 for x in range(3) ] >>> test [0, 1, 4]
:remove、pop、clear、del。remove与pop都只能删除一个元素、
clear清空列表。del可以切片删除。
>>> test=[0,1,2,3,4] >>> test.remove(3) >>> test [0, 1, 2, 4]
>>> test=[0,1,2,3,4]
>>> test.pop()
4
>>> test
[0, 1, 2, 3]
>>>
>>> test.pop(1)
1
>>> test
[0, 2, 3]
>>>
>>> test=[0,1,2,3,4]
>>> test.clear()
>>> test
[]
>>> test=[0,1,2,3,4]
>>> del test[0:2]
>>> test
[2, 3, 4]
>>> del test[:]
>>> test
[]
>>> del test
>>> test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'test' is not defined
>>>
按照序列是否可被改变分类:
>>> a=6,7,8,89,9 >>> a (6, 7, 8, 89, 9) >>> a[0]=2 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'tuple' object does not support item assignment >>>
但是tuple可以包含可变对象
>>> a=43,4,5,6,[4,4,4,4] >>> a (43, 4, 5, 6, [4, 4, 4, 4]) >>> a[4][0]=99999 >>> a (43, 4, 5, 6, [99999, 4, 4, 4]) >>>
>>> a=() >>> a () >>> a=0, >>> a (0,) >>>
tuple的解压缩
>>> a,b,c=3,4,5 >>> a 3 >>> b 4 >>> c 5 >>>
tuple的打包
>>> a=3,4,5,5 >>> a (3, 4, 5, 5) >>>
>>> for i in reversed(range(1,6,1)): ... print(i) ... 5 4 3 2 1 >>>
>>> a=[] >>> b=[] >>> a is b False >>> a=9 >>> b=9 >>> a is b True >>> a is not b False >>>
>>> test="basecee" >>> 'a' in test True >>> 'f' in test False >>> 'f' not in test True >>> "ba" in test True
>>> 6+8>12 True >>> 13<6+9 True >>>
>>> 12==10 or 10==10 True >>> 10>5 and 9<0 False >>>
阅读网址:
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
python求numpy中array按列非零元素的平均值案例
网友评论