Python “in” with multiple variables

前端 未结 0 1439
有刺的猬
有刺的猬 2020-12-08 08:18

So I\'ve got this piece of code:

OPTION_1 if (i in (0, 1, 2) and j in (0, 1, 2)) else OPTION_2

I wonder if I can shorten it somehow. Tried this:

相关标签:
回答
  • 消灭零回复
提交回复
热议问题