Using print instead of file.write(str)
Sion Arrowsmith
siona at chiark.greenend.org.uk
Fri Jun 2 11:30:22 EDT 2006
A.M <alanalan at newsgroup.nospam> 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, although I can't find it in the FAQ):
for x in range(10):
sys.stdout.write(str(x))
to print:
0123456789
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list