Discuss / Python / 感觉有点啰嗦

感觉有点啰嗦

Topic source

def Judge(s): i = 0 while(i<len(s)): if(s[i]!=' '): return 1 i = i+1 return 0

def trim(s): if Judge(s)==0: print('Nothing') return None else: if s[0]==' ': return trim(s[1:]) elif s[-1]==' ': return trim(s[:-1]) else: return s


  • 1

Reply