def trim(s):
if len(s) > 0:
if s[0] == ' ':
return trim(s[1:])
elif s[-1] == ' ':
return trim(s[:-1])
else:
return s
Sign in to make a reply
石头王国精挑细选的石头
def trim(s):
if len(s) > 0:
if s[0] == ' ':
return trim(s[1:])
elif s[-1] == ' ':
return trim(s[:-1])
else:
return s
else:
return s