“For” loop first iteration

前端 未结 13 2380
渐次进展
渐次进展 2020-12-04 15:17

I would like to inquire if there is an elegant pythonic way of executing some function on the first loop iteration. The only possibility I can think of is:

f         


        
13条回答
  •  误落风尘
    2020-12-04 15:58

    Can't you do root.copy(something.get()) before the loop?

    EDIT: Sorry, I missed the second bit. But you get the general idea. Otherwise, enumerate and check for 0?

    EDIT2: Ok, got rid of the silly second idea.

提交回复
热议问题