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]
Sign in to make a reply
Aspire
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]