Including end=" as a parameter of print()BIF will cause the function to turn off the default behavior of "automatically including newlines in the output".
The principle is:
is End passes an empty string at the end, so that the print function does not add a newline character to the end of the string, but adds an empty string. In fact, this is also a grammatical requirement, indicating that the statement has not ended. This is only useful for Python3, not Python2 Supported.
Print defaults to printing one line with a newline at the end. end=' ' means no newline at the end, just add a space.
Related recommendations: " Python video tutorial》
Interactive mode, the effect is as follows:
>>> print('a') a >>> print('a',end=' ') a >>> print('a',end='1234') a1234 >>>
The above is the detailed content of What does end=' ' mean in python. For more information, please follow other related articles on the PHP Chinese website!