# -*- coding: utf-8 -*-def trim(s): if len(s) == 0: return '' if s[0] == ' ': s = trim(s[1:]) elif s[-1] == ' ': s = trim(s[:-1]) return s
比我写得简洁多了,发现了新大陆
这是递归吗?好简洁!
这样没法去中间的空格吧,我看他测试里还有一个‘ hello world ’
没事了我傻了
这个代码太美了
Sign in to make a reply
夕桐