Make Python output more beautiful and Python output more beautiful
Print by default, the output is a line feed. If you want to implement a line feed, you need to add a line feed at the end of the variable.End = "":
Student_age = 18
Print ("student age:", student_age)
# Print ("student age:"), print (student_age) does not wrap
# Default line feed after print execution
Print ("hello, world! ", End =" \ n ")
Print ("hello, world! ", End =" ") # Do not wrap
Print ("hello, world! ", End = "")
Print ("Abby", "Candy", "Tina", "Sandy", sep = "= ")
SepDelimiter
For example:
Money = 121.
Print ("the consumption amount is:", money, sep = "$ ")
PrintYou can also output the content to a file.
Str01 = "the consumption amount is: $128"
File01 = open ("d: \ sales.txt", "w ")
Print (str01, file = file01) # An exception occurs in the file output, and exception handling is required.