Explanation
1. Reverse parameter collection, that is, directly use lists, tuples, and dictionaries as function parameters. However, when calling the function, the actual parameter must be marked with *.
2. Even if the parameters support collection, if the program needs to transfer a tuple to a tuple, it needs to use reverse collection.
Examples
def param_test(name, age): print('name=', name) print('age=', age) data = ['python之父', 18] param_test(*data)
Data types of python:
1. Numeric types, including int (integer type), long (long integer type) and float (floating point type).
2. Strings, respectively str type and unicode type.
3. Boolean type. The Python Boolean type is also used for logical operations and has two values: True (true) and False (false).
4. List, list is the most frequently used data type in Python, and any data type can be placed in the collection.
5. Tuple, the tuple is marked with "()", and the internal elements are separated by commas.
6. Dictionary. A dictionary is a collection of key-value pairs.
7. Set, a set is an unordered, non-duplicate data combination.
The above is the detailed content of What does python reverse parameter collection refer to?. For more information, please follow other related articles on the PHP Chinese website!