hello,

Lie Ryan wrote:

There has never been print-with-formatting in python, what we have is the % string substitution operator, which is a string operation instead of print operation.

Yes, I see that now, thanks for clarifying it. I guess I thought
so because I've always associated the % formatting with printing.

I am wondering if there is a way to use print to write
formatted output to files?

Of course:

f = open(...)
open.write('%s' % foo)

very nice ..

or using the new superpowerful str.format()
 >>> 'foo: {0} bar: {baz:3.1f} {1:e}'.format(123, 456.789, baz = 123.456)
'foo: 123 bar: 123.5 4.567890e+02'

I'll have to check it out - thanks again,

Esmail

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to