Discuss / Python / python学习打卡 0214 果然不同人的解法不一样,膜拜大家,学习了!

python学习打卡 0214 果然不同人的解法不一样,膜拜大家,学习了!

Topic source

while s!='' and s[0]==' ':

      s=s[1:]

   while s!='' and s[-1]==' ':

      s=s[:-1] 

   return s

if s != '':    while bool(s) and s[0] == ' ':        s = s[1:]    while bool(s) and s[-1] == ' ':        s = s[:-1]    return selse:    return ''

  • 1

Reply