可以使用字符串替换函数 replace() 来去除 \

示例代码:

string = '2020/11/25 16:00:00'
string = string.replace('\\', '')
print(string)

输出结果:

2020/11/25 16:00:00

在这个示例中,我们将字符串中的 \ 替换为一个空字符串 '',从而去除了它们。

Python 字符串去除反斜杠 \  -  简单高效的代码示例

原文地址: https://www.cveoy.top/t/topic/lBne 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录