python numpy 判断两个数组完全相等

    import numpy as np
    a = np.array([1,2,3])
    b = np.array([1,2,3])
    print((a==b).all())
    a = np.array([3,2,1])
    b = np.array([1,2,3])
    print((a==b).all())

或者不用numpy

    print([1,2]==[1,2])
    print([1,2]==[2,1])
    原文作者:修行者GT
    原文地址: https://blog.csdn.net/guotong1988/article/details/86649395
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞