当前位置:  首页>> 技术小册>> Python合辑4-130个字符串操作示例

在 Python 中删除开头和结尾空格

  1. s = ' canada '
  2. print(s.strip())

Output:

  1. canada

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