Discuss / Python / try this

try this

Topic source

施谷草

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

def trim(s):

  while s != '' and s[0] == ' ':

    s = s[1:]

  while s != '' and s[-1] == ' ':

    s = s[:-1]

  return s


  • 1

Reply