Re: Using print instead of file.write(str)

2006-06-04 Thread Bruno Desthuilliers
John Machin a écrit : (snip) > ... or was that a rhetorical question? It was. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using print instead of file.write(str)

2006-06-04 Thread Bruno Desthuilliers
Tim Roberts a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>Sion Arrowsmith a écrit : >> (snip) >>>"more flexible"? More convenient, yes. More powerful, maybe. But I >>>don't see more flexible. Everything print can to stdout.write() can >>>do. The reverse isn't true. eg (this app

Re: Using print instead of file.write(str)

2006-06-03 Thread John Machin
On 3/06/2006 9:47 AM, Bruno Desthuilliers wrote: > > Now, given: > > bird = "parrot" > beautiful = "dead" > > How would you do the following with f.write() ? > > print "this", bird, "is", beautiful > > (without using string formating, of course...) Like this: f.write((' '.join(str(x)

Re: Using print instead of file.write(str)

2006-06-03 Thread Alex Martelli
Tim Roberts <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >Sion Arrowsmith a écrit : > >> A.M <[EMAIL PROTECTED]> wrote: > >> > >>>I found print much more flexible that write method. > >> > >> "more flexible"? More convenient, yes. More powerful, maybe. But I >

Re: Using print instead of file.write(str)

2006-06-03 Thread Tim Roberts
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith a écrit : >> A.M <[EMAIL PROTECTED]> wrote: >> >>>I found print much more flexible that write method. >> >> "more flexible"? More convenient, yes. More powerful, maybe. But I >> don't see more flexible. Everything print can to stdou

Re: Using print instead of file.write(str)

2006-06-02 Thread Bruno Desthuilliers
Sion Arrowsmith a écrit : > A.M <[EMAIL PROTECTED]> wrote: > >>I found print much more flexible that write method. > > > "more flexible"? More convenient, yes. More powerful, maybe. But I > don't see more flexible. Everything print can to stdout.write() can > do. The reverse isn't true. eg (this

Re: Using print instead of file.write(str)

2006-06-02 Thread Sion Arrowsmith
A.M <[EMAIL PROTECTED]> wrote: >I found print much more flexible that write method. "more flexible"? More convenient, yes. More powerful, maybe. But I don't see more flexible. Everything print can to stdout.write() can do. The reverse isn't true. eg (this appears to be a FAQ on this group, althoug

Re: Using print instead of file.write(str)

2006-06-01 Thread A.M
Yes, it saved my time big time. Thank you Bruno. I use the print >>>file to generate HTML files. print is very flexible and nice. The dictionary formatting that Brunto said is awesome! Thanks again, Alan "Jon Clements" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Di

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
I meant 'trailing': not leading. mea culpa. Jon. Jon Clements wrote: > Didn't know of the >> syntax: lovely to know about it Bruno - thank > you. > > To the OP - I find the print statement useful for something like: > print 'this','is','a','test' > >>> 'this is a test' > (with implicit newline

Re: Using print instead of file.write(str)

2006-06-01 Thread Jon Clements
Didn't know of the >> syntax: lovely to know about it Bruno - thank you. To the OP - I find the print statement useful for something like: print 'this','is','a','test' >>> 'this is a test' (with implicit newline and implicit spacing between parameters) If you want more control (more flexibility,

Re: Using print instead of file.write(str)

2006-06-01 Thread Bruno Desthuilliers
A.M a écrit : > Hi, > > > I found print much more flexible that write method. Can I use print instead > of file.write method? > f = open("/path/to/file") print >> f, "this is my %s message" % "first" f.close() To print to stderr: import sys print >> sys.stderr, "oops" FWIW, you and use stri

Using print instead of file.write(str)

2006-06-01 Thread A.M
Hi, I found print much more flexible that write method. Can I use print instead of file.write method? Thank you, Alan -- http://mail.python.org/mailman/listinfo/python-list