Typeerror: Slice Indices Must Be Integers Or None Or Have An __index__ Method. How To Resolve It?
if w
Solution 1:
Your error is:-
TypeError: slice indices must be integers orNoneor have an __index__ method
slice indices, in your case refer to the variables that you are using to slice the list in
normalized_char[:, start:start+w] =charThat is - start and start+w. For list slicing, these must be integers or have an __index__ method. This __index__ method is a special method that returns integer value for that object.
You should be able to solve your issue by ensuring that you provide correct slice indices. You can use start = (h-w)//2(integer division) to make sure that start is an integer.
Post a Comment for "Typeerror: Slice Indices Must Be Integers Or None Or Have An __index__ Method. How To Resolve It?"