gpt4 book ai didi

python - 使用 python 2.7 和 3.5 的 string.strip() 中的奇怪错误

转载 作者:太空宇宙 更新时间:2023-11-04 10:15:22 25 4
gpt4 key购买 nike

<分区>

我在使用 string.strip() 进行的非常简单的字符串操作中得到了一些非常奇怪的结果。我想知道这是一个只影响我的问题(我的 python 安装有问题吗?)还是一个常见的错误?

这个错误非常有线,它在这里:

>>> a = './omqbEXPT.pool'
>>> a.strip('./').strip('.pool')
'mqbEXPT' #the first 'o' is missing!!!

它仅在 './' 后跟 'o' 时发生!

>>> a = './xmqbEXPT.pool'
>>> a.strip('./').strip('.pool')
'xmqbEXPT'

这是怎么回事?!我已经在 python 2.7 和 3.5 上对此进行了测试,结果没有改变。

25 4 0
文章推荐: python - 如何备份/恢复 python virtualenv?
文章推荐: javascript - jQuery/JavaScript 根据当前页面隐藏元素?
文章推荐: html -
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com