Python的数组合并

https://blog.csdn.net/hustqb/article/details/78090365

import numpy as np

if __name__ == '__main__':

    a=[1,2,3,4]
    A=np.append(a,a)                             #给数组的一行进行扩增
    print(A)

    A=np.append([a],[a],axis=0)              #给数组扩充一行
    print(A)

输出:

[1 2 3 4 1 2 3 4]

[[1 2 3 4]
 [1 2 3 4]]

猜你喜欢

转载自www.cnblogs.com/chulin/p/10056978.html