当前位置:  首页>> 技术小册>> Python合辑2-字符串常用方法

10、rsplit()

从右侧开始对字符串进行分隔。

  1. s = 'string methods in python'.rsplit(' ', maxsplit=1)
  2. print(s)
  3. # ['string methods in', 'python']

该分类下的相关小册推荐: