# 访问字符串 hello = "hello world!" hello[0] #获取第1个值:h hello[1:4] #获取第2-5个(不包括)范围的值:ell hello[-1] #获取最后一个值:!