tuple | list | string, repeating n times
Array, which means that each element is multiplied by n
import numpy as nparr = np.array([1, ])print(arr*3)list1 = [1, ]print(list1*3)tuple1 = (1, )print(tuple1*3)str1 = "python"print(str1*3)#[3]# [1, 1, 1]# (1, 1, 1)# pythonpythonpython
I have written several application cases about using the plum blossom* to unpack
python-The operator * is used for scenario analysis of unpacking - repeating modules
The above article describes how to use the unpacking operation to insert an element multiple times at a certain position in a list.
python-* unpacking and the application of the zip function, the return value of the zip function itself cannot be unpacked with *
The above article talks about the combination of the zip function and the unpacking mechanism.
python-deduction can directly pass in function parameters, deduction and the unpacking usage of the * (asterisk) operator
The above article describes how to use the derivation and unpacking mechanism to directly use the derivation as a function parameter.
*Unpacking can be done on almost all iterable objects.; It can be understood colloquially as opening the "bag" to facilitate "taking things" from it.