[issue32656] writing to stdout prints extraneous size character

Zachary Ware report at bugs.python.org
Wed Jan 24 15:59:04 EST 2018


Zachary Ware <zachary.ware at gmail.com> added the comment:

This is not a bug, it's a side effect of using the REPL for this test and not assigning the return value of `sys.stdout.write` to anything.  Try the following:

>>> import sys
>>> character_count = sys.stdout.write('python\n') # note trailing newline
python
>>> character_count
6
>>> print('python')
python
>>> 

Or try saving your original test to a file and running it.

----------
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32656>
_______________________________________


More information about the Python-bugs-list mailing list