Discuss / Python / 这个应该没问题吧

这个应该没问题吧

Topic source

梦魇

#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

哇  真的简洁


  • 1

Reply