Discuss / Python / 递归

递归

Topic source

虫二YCY

#1 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

def trim(s): if s[0]!=' ' and s[-1]!=' ': print(s) if s[0]==' ': s=trim(s[1:]) if s[-1]==' ': s=trim(s[:-1]) s=str(input()) trim(s)


  • 1

Reply