31个必备的Python字符串方法,建议收藏!
作者:互联网
1、Slicing
s = ' hello ' s = s[:] print(s) # hello s = ' hello ' s = s[3:8] print(s) # hello
2、strip()
s = ' hello '.strip() print(s) # hello s = '###hello###'.strip() print(s) # ###hello###
3、lstrip()
s = ' hello '.lstrip() print(s) # hello
4、rstrip()
s = ' hello '.rstrip() print(s) # hello
https://mp.weixin.qq.com/s/3ebqb72hz4wvBaIP0vk-0A
标签:Python,31,hello,lstrip,rstrip,strip,print,必备,### 来源: https://www.cnblogs.com/JYB2021/p/15945965.html