Delete newline / return carriage in file output

后端 未结 6 1537
无人及你
无人及你 2020-12-16 16:55

I have a wordlist that contains returns to separate each new letter. Is there a way to programatically delete each of these returns using file I/O in Python?

Edit

6条回答
  •  被撕碎了的回忆
    2020-12-16 17:51

    The most efficient is to not specify a strip value

    '\nsomething\n'.split() will strip all special characters and whitespace from the string

提交回复
热议问题