str = 'I love you'#取字符串第一个元素print(str[0])#获取字符串第一个到第五个元素print(str[0:5])#获取字符串最后一个元素print(str[-1])
评论: 字符串的切片与索引