Discuss / Python / 字符串去空

字符串去空

Topic source

彩虹

#1 Created at ... [Delete] [Delete and Lock User]
def trim(s):    for i in s:        if s[0:1] ==' ':            s = s[1:]        if s[-1] ==' ':            s = s[0:-1]    print(s)    return s

  • 1

Reply