`
羊小绵
  • 浏览: 52433 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
文章分类
社区版块
存档分类
最新评论

python截取字符串

阅读更多

某个字符串为stmp="abcdef54321"

取前面5个stmp[:5]

取后面5个stmp[-5:]

从前面开始取,不包括最后两个stmp[:-2]

从第5个开始取到最后stmp[4:]

从第1个取到第2个stmp[0:2]

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics