def trim(s): r=[] n=0 while n<len(s): if s[n]==' ': pass else: r.append(s[n]) n=n+1 return r
trim(' hello ') #可以去掉空格,但是多了逗号
Sign in to make a reply
ny12348
def trim(s): r=[] n=0 while n<len(s): if s[n]==' ': pass else: r.append(s[n]) n=n+1 return r
trim(' hello ') #可以去掉空格,但是多了逗号