What does python reverse parameter collection refer to?

PHPz
Release: 2023-05-13 23:01:10
forward
1608 people have browsed it

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)
Copy after login

What are the data types of python?

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template