def trim(s): if len(s)==0: return '' else: while s[:1]==' ': s=s[1:] while s[-1:]==' ': s=s[:-1] return s
赞
再改良~
def trim(s): if s!='': while s[:1]==' ': s=s[1:] while s[-1:]==' ': s=s[:-1] return s
Sign in to make a reply
又耳日宣火韦
def trim(s): if len(s)==0: return '' else: while s[:1]==' ': s=s[1:] while s[-1:]==' ': s=s[:-1] return s