Discuss / Python / chatgpt帮忙写的

chatgpt帮忙写的

Topic source

Ashen One

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

def trim(s):

    start = 0

    end = len(s)

    while start < end and s[start] == " ":

        start = start + 1

    while end > start and s[end-1] == " ":

        end = end - 1

    return s[start:end]

s = input("请输入任意文本:")

print(trim(s))


  • 1

Reply