You can unpack a tuple or a list into positional arguments using a star.
def add(a, b, c):
print(a, b, c)
x = (1, 2, 3)
add(*x)
Similarly, you can use double star to unpack a dict into keyword arguments.
x = { 'a': 3, 'b': 1, 'c': 2 }
add(**x)
More Related Contents:
- How to iterate through two lists in parallel?
- Iterating over every two elements in a list [duplicate]
- What are the advantages of NumPy over regular Python lists?
- Are lists thread-safe?
- Iterate through pairs of items in a Python list [duplicate]
- Getting a list of values from a list of dicts
- What is the most pythonic way to pop a random element from a list?
- Naming conflict with built-in function
- Interleaving Lists in Python [duplicate]
- Does a slicing operation give me a deep or shallow copy?
- Confused about __str__ on list in Python [duplicate]
- Print LIST of unicode chars without escape characters
- Combining two lists and removing duplicates, without removing duplicates in original list
- Confusing […] List in Python: What is it?
- Get unique values in List of Lists
- How to delete an item in a list if it exists?
- What is time complexity of a list to set conversion?
- How to apply __str__ function when printing a list of objects in Python [duplicate]
- remove None value from a list without removing the 0 value
- Filtering a list based on a list of booleans
- Creating an empty list in Python
- Changing one dict changes all dicts in a list of dicts [duplicate]
- Python string.join(list) on object array rather than string array
- How to zip two lists of lists
- How to create a number of empty nested lists in python [duplicate]
- How can I sort a list, according to where its elements appear in another list?
- Size of a Python list in memory
- Iterate a list with indexes [duplicate]
- How to extract all values from a dictionary in Python?
- Comparing 2 lists consisting of dictionaries with unique keys in python