sys.stderr.write returns string length in Python 3

A

Alan G Isaac

Is this new behavior intentional? ::

>>> sys.stderr.write("thisisatest\n")
thisisatest
12

Here is the reason for it:

>>> help(sys.stderr.write)
Help on method write in module io:
write(self, s: str) method of io.TextIOWrapper instance

Thank you,
Alan Isaac
 
F

Fredrik Lundh

Alan said:
Can you give me an example of using the returned value?

it's for consistency with stream objects that support raw I/O (as
described in the PEP). when using buffered I/O, you can ignore it.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top