📜  python比较两个数组 - Python代码示例

📅  最后修改于: 2022-03-11 14:46:01.275000             🧑  作者: Mango

代码示例2
def binary_isArrayInArray(main_array, compare_array):
    for i in range(len(main_array)-len(compare_array)):
        temp_array = []
        for j in range(len(compare_array)):
            temp_array.append(main_array[i + j])
        print(f'{temp_array} xor {compare_array} = {np.any(np.logical_xor(temp_array, compare_array))}')
        if np.any(np.logical_xor(temp_array, compare_array)) == False: return True

    return False
#takes in two binary arrays and looks wether the second one is part of the first one