我正在尝试使用删除后缀删除文件名的 .png 部分
'x.png'.removesuffix('.png')
但它不断返回:
AttributeError: 'str' object has no attribute 'removesuffix'
我试过其他一些字符串函数,但我一直得到“str”对象没有属性“”。我该怎么做才能解决这个问题?
python string
python ×1
string ×1