热线电话:13121318867

登录
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

31.2426
2
关注作者
收藏
评论(1)

发表评论
firefly0818
2020-06-13
嘻嘻
0.0000 0 0 回复