Printing to stdout in Python: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
<syntaxhighlight lang='py'>
<syntaxhighlight lang='py'>
print('something')
print('something')
</syntaxhighlight>
To avoid sending a new line at the end:
<syntaxhighlight lang='py'>
print('something', end='.')
print('something', end='')
</syntaxhighlight>
</syntaxhighlight>

Revision as of 06:04, 10 March 2022

Internal

Overview

To send a string followed by new line to stdout:

print('something')

To avoid sending a new line at the end:

print('something', end='.')
print('something', end='')