print "hello", >> file

Yar3k programisci_listy at murator.org_zmien_na_com.pl
Tue Feb 25 10:32:41 CET 2003


On Tue, 25 Feb 2003 08:57:20 GMT, Alex Martelli <aleax at aleax.it>
wrote:

>Hilbert wrote:
>
>> Hello,
>> 
>> Why does the following result in an error?
>> 
>> f = file("welcome.txt","w")
>> print "hello", >> f
>
>Because the "print>>BAH" syntax is all wacko.  You
>need to code:
>    print >> f, "hello"

why not f.write("hello") ?




More information about the Python-list mailing list