I didn't understand how to use the asterisk (*) in Python (3.7 I'm using now), so I looked it up.
https://docs.python.org/ja/3.7/reference/
Example ↓. This is unlikely to be used much.
>>>
>>> ff = {'a':1,'b':2}
>>> gg = {**ff,'c':3}
>>> gg
{'a': 1, 'b': 2, 'c': 3}
>>>
Example ↓. This may be used. However, it is not appropriate as an example in this section. Is this an argument system, if anything? ??
>>>
>>> (hh,*ii)=1,2,3,4,5,6
>>> ii
[2, 3, 4, 5, 6]
>>>
I think the example below is appropriate.
>>>
>>> ii=[1,2,3]
>>> jj=[100,200,*ii]
>>> jj
[100, 200, 1, 2, 3]
>>> jj=[100,200,ii]
>>> jj
[100, 200, [1, 2, 3]]
>>>
Nothing in particular. If you have any comments, please let us know. : candy:
Recommended Posts