def trim(s):
if len(s) != 0:
while s[0] == ' ':
if s == ' ':
break
s = s[1:]
while s[-1] == ' ':
s = s[:-1]
return ''
else:
return s
Sign in to make a reply
M-F恶魔
def trim(s):
if len(s) != 0:
while s[0] == ' ':
if s == ' ':
break
s = s[1:]
while s[-1] == ' ':
if s == ' ':
break
s = s[:-1]
if s == ' ':
return ''
else:
return s