鱼C论坛

 找回密码
 立即注册
查看: 1165|回复: 4

[已解决]求助大神,为什么会报错呢?

[复制链接]
发表于 2022-2-10 14:55:42 | 显示全部楼层 |阅读模式
10鱼币
>>> "www.ilovefishc.com".removeprefix("www.")
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    "www.ilovefishc.com".removeprefix("www.")
AttributeError: 'str' object has no attribute 'removeprefix'
>>>
最佳答案
2022-2-10 14:55:43
python的版本问题,removeprefix和removesuffix这两个字符串方法是python3.9引入的新特性

最佳答案

查看完整内容

python的版本问题,removeprefix和removesuffix这两个字符串方法是python3.9引入的新特性
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-2-10 14:55:43 | 显示全部楼层    本楼为最佳答案   
python的版本问题,removeprefix和removesuffix这两个字符串方法是python3.9引入的新特性
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-2-10 15:01:21 | 显示全部楼层
可以呀,我运行起来没错:
  1. "www.ilovefishc.com".removeprefix("www.")
  2. 'ilovefishc.com'
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-2-10 15:07:12 | 显示全部楼层
python爱好者. 发表于 2022-2-10 15:01
可以呀,我运行起来没错:

行了吧,给个好评,谢谢兄弟!
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-2-10 15:09:26 | 显示全部楼层
isdkz 发表于 2022-2-10 15:07
python的版本问题,removeprefix和removesuffix这两个字符串方法是python3.9引入的新特性

对,https://docs.python.org/zh-cn/3.9/whatsnew/3.9.html
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-30 10:30

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表