Python 切片

格式: [start:end:step]

• [:] 提取从开头(默认位置0)到结尾(默认位置-1)的整个字符串
• [start:] 从start 提取到结尾
• [:end] 从开头提取到end - 1
• [start:end] 从start 提取到end - 1
• [start:end:step] 从start 提取到end - 1,每step 个字符提取一个
• 左侧第一个字符的位置/偏移量为0,右侧最后一个字符的位置/偏移量为-1

posted @ 2018-12-20 09:11  wfc139  阅读(162)  评论(0编辑  收藏  举报