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

4、rstrip()

移除字符串右侧指定的字符(默认为空格或换行符)或字符序列。

  1. s = ' hello '.rstrip()
  2. print(s)
  3. # hello

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