#!/usr/bin/env python
# -*- coding:utf-8 -*-
#python 利用切片去除首尾空
def trim(text):
while True:
if text[:1] == " ":
text = text[1:]
print(text)
else:
break
while True:
if text[-1] == " ":
text = text[:-1]
print(text)
else:
break
return
trim(" 康师傅 ")
python 利用切片去除首尾空
猜你喜欢
转载自blog.csdn.net/u010590983/article/details/87716686
今日推荐
周排行