Как удалить нежелательные разрывы строк только в тексте? - PullRequest
0 голосов
/ 06 ноября 2019

Как удалить нежелательные разрывы строк только в тексте (файл yml, Pycharm ide)?

utter_ask_family10:
- text: "I'm helping my parents, but don't let Dad hear me.)
But it is very difficult. I say I have money - listen to me, please, I bought you a Honda car,
 you're my dad, you have an anniversary, I want to give you... It didn't work out."
- text: "Helping my parents is very difficult, they don't take money from me, but through gifts. Daddy in general - we fight with him."

Желаемый вывод:

utter_ask_family10:
- text: "I'm helping my parents, but don't let Dad hear me.) But it is very difficult. I say I have money - listen to me, please, I bought you a Honda car, you're my dad, you have an anniversary, I want to give you... It didn't work out."
- text: "Helping my parents is very difficult, they don't take money from me, but through gifts. Daddy in general - we fight with him."

Как вы можете видеть, это удаляет \ n, нотакже добавьте «пробел» перед каждой текстовой частью (как перед «Но»)

Подумайте о регулярном выражении, но оно просто удаляет \ n \ n

...