>>> a = '1'
>>> list[a]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'type' object is not subscriptable
>>> [a]
['1']
When generating an array, there is no need to add the 'list' method, just use square brackets directly
Analysis:
subscriptable means that it can have subscripts.
The reason for the error is that an object without subscript operation is used as object [i], such as int object variable [i], an error will be reported. Double check the error line.
Here is to convert string to list, invalid. unless
>>> a = '1234'
>>> list(a)
['1', '2', '3', '4']
>>>