Remove all line breaks from a long string of text

前端 未结 8 1922
长发绾君心
长发绾君心 2020-11-28 19:53

Basically, I\'m asking the user to input a string of text into the console, but the string is very long and includes many line breaks. How would I take the user\'s string a

8条回答
  •  感情败类
    2020-11-28 20:30

    updated based on Xbello comment:

    string = my_string.rstrip('\r\n')
    

    read more here

提交回复
热议问题