python中rstrip的用法

# rstrip是删除字符串末尾的字符,不写的话是空格

str = '     hello, world!        '
print(str.rstrip())
str2 = 'hello, world!000000000000'
print(str.rstrip('0'))

猜你喜欢

转载自blog.csdn.net/qfpkzheng/article/details/80026037