my_str = "  adsffff adsfsad     "

my_str.strip()

使用strip()默认将 str 两端的空白字符去除掉 同时还有rstrip() 和 lstrip() 方法, 作用分别为去除 右边的空白字符/左边的空白字符

相关文章: