交作业
Topic sourceif len(s)==0 or s==' ':
return s
while len(s)>0 and s[0]==' ':
s= s[1:]
while len(s)>0 and s[-1]==' ':
s = s[:-2]
return s
lens = len(s)
if lens == 0 or s == ' ':
return s
l=lens
for i in range(lens):
if s[i] !=' ':
l = i
break
if l == lens:
s =''
else:
for i in range(lens):
if s[-i-1] !=' ':
s = s[l:-i+lens]
break
return s
- 1
轩辕泽霖
if len(s)>0 and s=='':
return s
while len(s)>0 and s[0]==' ':
s= s[1:]
while len(s)>0 and s[-1]==' ':
s = s[:-2]
return s