def trim(s):
if len(s) == 0: return s
if s[0] == ' ': return trim(s[1:])
return trim(s[:-1]) if s[-1] == ' ' else s
Sign in to make a reply
新军
def trim(s):
if len(s) == 0: return s
if s[0] == ' ': return trim(s[1:])
return trim(s[:-1]) if s[-1] == ' ' else s