Question about output...

Peter Hansen peter at engcorp.com
Thu Oct 17 17:53:16 EDT 2002


Bengt Richter wrote:
> To make things even more like C (other than the lack of ';')

Hey, what's wrong with using ";" ?  ;-)

> def printf(fmt, *args):
>     import sys
>     sys.stdout.write(fmt % args)
> 
> printf("The average of %d and %d is %d\n", firstInt, secondInt, average)

 >>> printf("The average of %d and %d is %d\n", 10, 20, 15);
The average of 10 and 20 is 15

-the-semicolon-is-silent-ly yr's,
  Peter




More information about the Python-list mailing list