Home >Backend Development >Python Tutorial >What does end=' ' mean in python

What does end=' ' mean in python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-21 09:47:4810584browse

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.

What does end=' ' mean in python

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn