2020-06-10
阅读量:
1826
Python 3.9 Beta2 版本更新:
实现的功能如下:
'abcdef'.cutprefix('abc') # 返回'def''
abcdef'.cutsuffix('ef') # 返回'abcd'
龟叔更偏好这种写法: removeprefix() 和 removesuffix()
可能最终的选择有:
cutprefix - 删除指定的前缀。
trimprefix - 删除指定的前缀。
stripprefix - 删除指定的前缀。
removeprefix - 删除指定的前缀
最终会选择什么,期待3.9正式更新!!!
来源于: CSDN






推荐帖子
0条评论
0条评论
3条评论