>>>print(np.unravel_index(99,(6,7,8)))
(1, 5, 3)
>>>Z = np.tile( np.array([[0,1],[1,0]]), (4,4))
>>>print(Z)
[[0 1 0 1 0 1 0 1]
[1 0 1 0 1 0 1 0]
[0 1 0 1 0 1 0 1]
[1 0 1 0 1 0 1 0]
[0 1 0 1 0 1 0 1]
[1 0 1 0 1 0 1 0]
[0 1 0 1 0 1 0 1]
[1 0 1 0 1 0 1 0]]
>>>color = np.dtype([("r", np.ubyte, 1),
("g", np.ubyte, 1),
("b", np.ubyte, 1),
("a", np.ubyte, 1)])
>>>print(color)
[('r', 'u1'), ('g', 'u1'), ('b', 'u1'), ('a', 'u1')]
>>>Z = np.dot(np.ones((5,3)), np.ones((3,2)))
>>>print(Z)
# Alternative solution, in Python 3.5 and above
>>>Z = np.ones((5,3)) @ np.ones((3,2))
[[3. 3.]
[3. 3.]
[3. 3.]
[3. 3.]
[3. 3.]]
>>>print(sum(range(5),-1))
>>>improt numpy as np
>>>print(np.sum(range(5),-1))
9 10
np.sum的第二个参数是维度,这里只有一维,即1+2+3+4=10