[Tutor] Making a Primary Number List generator

Steven D'Aprano steve at pearwood.info
Thu May 16 02:07:48 CEST 2013


On 16/05/13 06:02, Alan Gauld wrote:
> On 15/05/13 16:51, Marc Tompkins wrote:
>
>> Actually, I was mixing up my memory of an overloaded print() function
>
> And C's printf() returns the number of chars printed.
> I actually wish python had followed suit because, as Marc says,
> it can occasionally be useful...


Guido's time machine strikes again.


py> import sys
py> sys.stdout.write('NOBODY expects the Spanish Inquisition!\n')
NOBODY expects the Spanish Inquisition!
40


The write() method of file objects in Python 3 return the number of characters written.



-- 
Steven


More information about the Tutor mailing list