Skip to content Skip to sidebar Skip to footer

How To Pass A List As A Function's Arguments

If I have a function: def run(time, message, time_span_pattern): ... And a list like: run_args = ['1s', '1 second alarm', <_sre.SRE_Pattern object at 0x100435680>] How

Solution 1:

You're looking for:

run(*run_args)

This is explained in more detail in this StackOverflow answer about the star and double star operator

It's also covered in the python docs

Post a Comment for "How To Pass A List As A Function's Arguments"