I've tried, but I can't figure this out so far. I want to create a list of tuples, each one built out of dictionary values:
my_list = [(x['field1'], x['field2']) for x in my_dict]
But the issue is that I want to do this inside a function, passing the fields I want to get to *args:
my_func('field1', 'field2')
How can I build the first list comprehension out of the *args list?
Thanks!
I'll try to clarify:
Briefly, what I want to do is map this:
my_func('field1', 'field2')
To this:
tuple(x['field1'], x['field2'])
Which will be a statement inside my_func(*args)