How to print a string without including '\n' in Python

前端 未结 8 1003
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 16:26

Suppose my string is:

\' Hai Hello\\nGood eve\\n\'

How do I eliminate the \'\\n\' in between and make a string print like :

8条回答
  •  梦毁少年i
    2021-01-01 16:41

    In Python 2.6:

    print "Hello.",
    print "This is on the same line"
    

    In Python 3.0

    print("Hello", end = " ")
    print("This is on the same line")
    

提交回复
热议问题