print "hello", >> file

Alex Martelli aleax at aleax.it
Tue Feb 25 03:57:20 EST 2003


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"


Alex





More information about the Python-list mailing list