def trim(s):
lenth = len(s)
st = 0
while ((st < lenth) and (s[st] == ' ')):
st = st + 1
while ((st < lenth) and (s[lenth-1] == ' ')):
lenth = lenth - 1
if (st > 0) or (lenth < len(s)):
return s[st:lenth]
return s
Sign in to make a reply
风
def trim(s):
lenth = len(s)
st = 0
while ((st < lenth) and (s[st] == ' ')):
st = st + 1
while ((st < lenth) and (s[lenth-1] == ' ')):
lenth = lenth - 1
if (st > 0) or (lenth < len(s)):
return s[st:lenth]
return s