5

How to destruct array to argument list like in javascript?

def foo( arg0, arg1 ): pass
bar = [ 32, 44 ]
foo( ...bar )
Pierre Dunn
  • 595
  • 3
  • 27

1 Answers1

11

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

foo(*bar)

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

rdas
  • 18,048
  • 6
  • 31
  • 42