s = 'hello '
def trim(s): return s
if trim(s[0]) == ' ': print(s[1:])elif trim(s[-1]) == ' ': print(s[:-1])else: print('格式正确')