if s=='': return s n=0 m=-1 while s[n]==" ": n=n+1 if n==len(s)-1: return '' while s[m]==" ": m=m-1 m=m+len(s)+1 return s[n:m]
是一种不太机智的方法啦
while s!='' and s[0]==' ':
s=s[1:]
while s!='' and s[-1]==' ':
s=s[:-1]
return s
#这个最好,绝了,你的代码又臭又长
这个确实厉害
Sign in to make a reply
尼克斯劳迪