Discuss / Python / 交作业

交作业

Topic source

Aspire

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

def trim(str):

    startIndex = 0

    endIndext = len(str)-1

    while ord(str[startIndex])==32:

        startIndex+=1

    while ord(str[endIndext])==32:

        endIndext-=1

    return str[startIndex:endIndext+1]


  • 1

Reply