【发布时间】:2020-10-23 23:55:11
【问题描述】:
在使用 Python 检索电子邮件时,我们如何摆脱“换行”符号“(\r\n)”? 1
【问题讨论】:
在使用 Python 检索电子邮件时,我们如何摆脱“换行”符号“(\r\n)”? 1
【问题讨论】:
使用
s = "ABCD\n\r"
s = s.replace("\n", "")
s = s.replace("\r", "")
print(s)
给出输出:
ABCD
使用replace 而不是strip,因为它不关心指定字符的位置。
【讨论】: