strip()、rstrip()、lstrip()
作者:互联网
点击查看代码
str1 = ' hello , welcome to the world '
# 去除字符串左右两边空白
str1.strip()
'hello , welcome to the world'
# 去除字符串右边空白
str1.rstrip()
' hello , welcome to the world'
# 去除字符串左边空白
str1.lstrip()
'hello , welcome to the world '
标签:lstrip,str1,welcome,字符串,rstrip,strip,去除,world,hello 来源: https://www.cnblogs.com/LingZhu927045556/p/16438066.html