解决 Python 报错 IndexError: list assignment index out of range分析 Python 对空列表直接按索引赋值抛出 IndexError 根因,提供 append、extend 与列表推导式安全写法方案。Python · 代码规范 · IndexError2026.10.30