Obtain objects of list separated by comma

Imaging I have this:

my_list = [{"a": 1, "b": 2}, {"a": 2, "b": 3}]

And I need to obtain only:

{"a": 1, "b": 2}, {"a": 2, "b": 3}

It will be passed into another function and that function does not accept Tuples nor Lists, only Dicts separated by comma.

_ = my_super_function_that_only_accepts_dicts_separated_by_comma(
  {"a": 1, "b": 2}, 
  {"a": 2, "b": 3},
)

>Solution :

Sounds like this would be met by a straight unpack action – put a star in front, *my_list. See for example how print works.

Leave a Reply