Discuss / Python / 作业5

作业5

Topic source

孤o赦免你

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

def trim(str):

    while str != '':

        if str[:1] == ' ':

            str = str[1:]

        elif str[-1:] == ' ':

            str = str[0:-1]

        else:

            break

    return str


  • 1

Reply