Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

funcs_and_args for loop python

funcs_and_args = [(func1, "150mm"),
                  (func1, "100mm",
                  (func2, "50mm"),
                  (func3, "50mm"),]
                   
for func, arg in funcs_and_args :
    try:
        func(arg)
        # exit the loop on success
        break
    except ExplicitException:
        # repeat the loop on failure
        continue
else:
    # List exhausted without break, so there must have always been an Error
    raise Exception("Error text")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #python
ADD COMMENT
Topic
Name
2+7 =