How to remove \n and \r from a string

后端 未结 2 1771
灰色年华
灰色年华 2021-02-05 09:11

I currently am trying to get the code from this website: http://netherkingdom.netai.net/pycake.html Then I have a python script parse out all code in html div tags, and finally

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 09:55

    yon use below

    to remove carriage return:

    • line = line.replace(r'\r', '') to remove tab
    • line = line.replace(r'\r', '')

提交回复
热议问题