Can someone explain why sys.stdout.write()
appends 11
to my string?
$ python3
Python 3.4.3+ (default, Jul 28 2015, 13:17:50)
[GCC
It's NOT appended to the written string. 11
here is the return value of sys.stdout.write()
, which is the number of characters written.
See write:
Write the string
s
to the stream and return the number of characters written.
It's similar to:
>>> def foo():
... print('something', end='')
... return 42
...
>>> foo()
something42