B
B
beduin012018-01-31 16:16:22
Python
beduin01, 2018-01-31 16:16:22

Is it possible to write the condition check string shorter?

Is it possible to somehow simplify the following code:

if csv_tr_opcode == 2 and one_row.opcode == 3 or one_row.opcode == 6:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2018-01-31
@AnnTHony

if all([csv_tr_opcode == 2, one_row.opcode in (3,  6)]):

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question