第27731题 单选题
已知Python列表my_list = [1, 2, 3, 4],以下哪种写法属于合法的容器边界安全校验,能够安全访问索引5的元素并避免程序崩溃?

原始直接访问代码print(my_list[5])会触发IndexError异常,下列选项中哪种处理方式符合容器边界安全校验的规范?

{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析