n1,n2 = 0, len(s)-1
while n1<len(s) and s[n1]==' ':
n1+=1
while n2>0 and s[n2]==' ':
n2-=1
return s[n1:n2+1]
Sign in to make a reply
路由跳变
n1,n2 = 0, len(s)-1
while n1<len(s) and s[n1]==' ':
n1+=1
while n2>0 and s[n2]==' ':
n2-=1
return s[n1:n2+1]