Discuss / Python / 作业

作业

Topic source

-- coding: utf-8 --

def trim(s):

if len(s)==0:
return s while s[0:1]==' ': s=s[1:] if len(s)==0: return s while s[-1]==' ': s=s[:-1] return s


  • 1

Reply