Discuss / Python / 作业(参考评论)

作业(参考评论)

Topic source

独具一格5

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

def trim(s): while s[:1]==' ': s=s[1:] while s[-1:]==' ': s=s[:-1] return s print(trim('hello ')) print(trim(' hello')) print(trim(' hello ')) print(trim(' hello world ')) print(trim(' '))


  • 1

Reply