Use of end and sep parameters in print statement in python

We use the print statement many times. The two commonly used attributes in the print statement are the end and sep parameters. The end parameter specifies the end of the output content. When this parameter is not written, the default end is a newline character. If You need to end with other characters and then write other characters. The sep parameter is used to set the symbol for connecting multiple objects to be output. Generally, multiple parameters are output in the print statement, and these parameters will be separated by commas. , If the sep attribute is not written, the default is to connect according to the space

if __name__ == '__main__':
    print("abd", "def", "ghi", end="!")
    print()
    print("abd", "def", "ghi", sep="")
    print("abd", "def", "ghi")
    print("abd", "def", "ghi", sep="*")

  

Guess you like

Origin blog.csdn.net/qq_39445165/article/details/115268636