6

How to destruct array to argument list like in javascript?

def foo( arg0, arg1 ): pass
bar = [ 32, 44 ]
foo( ...bar )

1 Answers1

15

It's called argument unpacking. Use the *args format

foo(*bar)

More info: https://www.geeksforgeeks.org/packing-and-unpacking-arguments-in-python/

rdas
  • 20,604
  • 6
  • 33
  • 46