首页 > 解决方案 > 如何在使用 python 时添加一行

问题描述

您好,我想知道如何转换它。

 0|13|16|16|3|"After MLG down and securely locked, a red light is illuminated \
n the flight deck. The possible causes are."        \
|out of adjustment sensor|wiring problem|shorted sensor|b|1| |zita-2686

进入这个

 0|13|16|16|3|"After MLG down and securely locked, a red light is illuminated the flight deck. The possible causes are." |out of adjustment sensor|wiring problem|shorted sensor|b|1| |zita-2686

你能帮帮我吗,因为我没有找到类似的东西

标签: python

解决方案


有很多方法可以用空替换换行符。尝试以下任何方法。

string = string.replace("\r","");
or
string = string.replace("\r\n","");
or
string = string.replace("\n","");
or
re.sub(r'\s' , '\n', line);

推荐阅读