Advertisement

TypeError: slice indices must be integers or None或对象类型错误解决办法

阅读量:

TypeError: slice indices must be integers or None

  • 目标
    • 1. 错误提示信息
    • 2. 引发错误的因素
    • 3. 应对问题的处理办法

目标

本文将为大家介绍如何解决Python程序运行过程中出现的TypeError: slice indices must be integers or None or have an __index__ method错误问题,旨在为读者提供有效的应对策略。

1. 错误提示

在运行Python3程序的过程中,出现了错误提示TypeError: slice indices must be integers or None or have an __index__ method,相关报错代码的具体位置如下:

复制代码
    # 现在在每个级别中添加左右两半图像
    LS = []
    for la, lb in zip(lpA, lpB):
    rows, cols, dpt = la.shape
    ls = np.hstack((la[:, 0:cols/2], lb[:, cols/2:]))
    LS.append(ls)
    
    
      
      
      
      

全部评论 (0)

还没有任何评论哟~