Discuss / Python / 尝试了三次做出来了

尝试了三次做出来了

Topic source

def  trim(s):

if s=='':

        return s

    else:

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

            s=s[1:]

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

            s=s[:-1]

    return s


  • 1

Reply