TL;DR --Be careful with Python's ʻappend` method that adds an element to the end of the list.
hardware
item | information |
---|---|
OS | macOS Catalina(10.15.7) |
hardware | MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports) |
Processor | 1.4 GHz quad core Intel Core i5 |
memory | 16 GB 2133 MHz LPDDR3 |
software
item | information |
---|---|
language | Python(3.8.5) |
It's not necessary to write about how to use it, but use it as follows.
$ Python
>> array = []
>> array.append('item')
>> print(array)
['item']
This ʻappend method does not return a list by itself, but returns
None`.
$ Python
>> array = []
>> print(array.append('item'))
None
If you inadvertently specify ʻArray.append (Item)when passing it to the return value or argument of the function,
None` will be passed.
I've taken a lot of time for this today, so I'll leave it as a memorandum.
Recommended Posts