03-字符串不能切片赋值
语法讲解
今天学: 尝试修改字符串会触发异常
s = "cat"
try:
s[0] = "b"
except Exception as e:
print(type(e).__name__)
小练习
运行下面代码后输出是什么?
s = "cat"
try:
s[0] = "b"
except Exception as e:
print(type(e).__name__)
提交要求: 只提交最终输出结果,不要添加多余的说明或引号。
全部评论