0
点赞
收藏
分享

微信扫一扫

python 字符串 去除左右空格 strip方法

影子喵喵喵 2023-03-08 阅读 125

s = "      abc      "

# 去左空格
s1 = s.lstrip()
print(s1)

# 去右空格
s2 = s.rstrip()
print(s2)

# 去左右空格
s3 = s.strip()
print(s3)

print("strip方法用的最多")

举报

相关推荐

0 条评论