python - how to deal with numerous elements in a condition? -


I sometimes need to use several elements in one condition, all of these are the same type

  Args = list (if not in "A"), or in args not in "R" or "c" in args: print ("something is missing")  < / Pre> 

It becomes complicated when the number of elements for testing grows, I tried to combine them into a list but the end result is ugly:

  args = For the list () which ["a", For "b", "c"]: If not in Arg: Print ("Something is actually missing") break   

A python to codify this type of condition The method will be (multiple components, all one, one for )

The typical way to do this is as follows:

  If not all (R "A", "B", "C"), RG for RG (RG in Arg):   

Also, consider raising an error instead of printing a message.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -