Python报错:list assignment index out of range
>>> a = []
>>> a[0] = 'dsfew'
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
a[0] = 'dsfew'
IndexError: list assignment index out of range
原因:列表a定义为一个空列表,a[0]这个元素不存在,所以为其赋值会报错