def trim(s): if s=='': return s while (s[0]==' '): s=s[1:] while (s[-1]==' '): s=s[:-1] return s
while (s[0]==' '): IndexError: string index out of range 你的代码怎么运行是这个结果?
Sign in to make a reply
用户6329855348
def trim(s): if s=='': return s while (s[0]==' '): s=s[1:] while (s[-1]==' '): s=s[:-1] return s