作业,不知道对不对
Topic sourcedef trim(s):
if s=='':
return s
while s[0]==' 'and s!=' ':
s=s[1:]
while s[-1]==' 'and s!=' ':
s = s[:-1]
if s==' ':
return ''
return s
- 1
def trim(s):
if s=='':
return s
while s[0]==' 'and s!=' ':
s=s[1:]
while s[-1]==' 'and s!=' ':
s = s[:-1]
if s==' ':
return ''
return s
FancyFai