0

Below is part of the code with the array I am talking about. It is a 2D list. My only knowledge of 2D list accessing is to reference each index, such as list[0][0] would give you the first item in the list. This line "img[0: lengthList[i], widthList[i]: widthList[i+1]] = outPut" has a lot of colons in it. what does the "0:" part mean? What does "widthList[i]: widthList[i+1]" mean?

When I try looking up more advanced array concepts in python I just get tutorials for things I already know how to do. Here an example where that list is being used.

img = np.zeros((length, width), np.float32)

for i in range(len(images)):
   output = np.zeros(images[i].shape)
   output = normalize(images[i])

   img[0: lengthList[i], widthList[i]: widthList[i+1]] = outPut
Some Dude
  • 27
  • 5
  • 2
    Starting position in list, ending position in list, how many steps to take through the list iteration – h0r53 Oct 05 '20 at 13:09
  • Thanks. My post got tagged as similar to this: https://stackoverflow.com/questions/509211/understanding-slice-notation. After reading it everything makes so much more sense now. I just didnt know what to search for. Thanks! – Some Dude Oct 05 '20 at 17:54

0 Answers0