def trim(s):
while s != '' and s[0] == ' ':
s = s[1:]
while s != '' and s[-1] == ' ':
s = s[:-1]
return s
Sign in to make a reply
施谷草
def trim(s):
while s != '' and s[0] == ' ':
s = s[1:]
while s != '' and s[-1] == ' ':
s = s[:-1]
return s