What does the asterisk in python mean?

widths, heights = zip (* (i.size for i in images))
args.output.write (img2pdf.convert (* list (map (img2pdf.input_images, images_path)

)

and i.sizecake here?

Apr.01,2021

  1. defines a variable parameter with only a * sign in front of it compared to defining a list or tuple parameter.
  2. In the
  3. zip function, the * zip () function is the inverse of the zip () function, turning the zip object into the data before the original combination.

examples are as follows:

Python 3.6.5 (default, Apr  1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = ['', 'www.os373.cn']
>>> b = ['', '']
>>> z = zip(a,b)
>>> list(z)
[('', ''), ('www.os373.cn', '')]
>>> list(z)
[]
>>> list(zip(*z))
[]
>>> list(zip(*zip(a,b)))
[('', 'www.os373.cn'), ('', '')]
>>>
Menu