sys.stderr.write returns string length in Python 3

Benjamin musiccomposition at gmail.com
Wed Jul 23 05:04:04 CEST 2008



Alan G Isaac wrote:
> Is this new behavior intentional? ::

Yes, it's in the PEP http://www.python.org/dev/peps/pep-3116/.
>
> 	>>> 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



More information about the Python-list mailing list