Make multiple logic expresion shorter

前端 未结 0 796
别跟我提以往
别跟我提以往 2020-11-29 03:36

Is there a way to make this example expression shorter:

if x == line[0] or x == line[1] or x == line[2] or x == line[3]:

I don\'t want to use

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