def trim(s):
if s[:1]==' ':
return trim(s[1:])
elif s[-1:]==' ':
return trim(s[:-2])
else:
return s
感觉应该是这样吧:
return trim(s[:-1])
Sign in to make a reply
☆◇﹏Kevin
def trim(s):
if s[:1]==' ':
return trim(s[1:])
elif s[-1:]==' ':
return trim(s[:-2])
else:
return s