Replace elements in array with class instances

后端 未结 2 1628
盖世英雄少女心
盖世英雄少女心 2021-01-22 20:53

This is similar to this so please read it first to understand what I am trying to do.

Now, I want to make the replacement when I have class instances.Something like:

2条回答
  •  误落风尘
    2021-01-22 21:55

    Make the replacement block like this. Also note this assumes your arr will be strictly in multiples of 5 and there will be as many blocks like b1,b2 etc as there are blocks in arr as given in the example.

    for i,b_arr in enumerate(d):
        temp_arr = []
        for j in range(5):
            if j

提交回复
热议问题