print to file

Erik Max Francis max at alcyone.com
Sun Nov 24 16:55:19 EST 2002


"Colin J. Williams" wrote:

> >>> f=file('ugh.py', 'w')
> >>> print 'abc' >> f
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> TypeError: unsupported operand type(s) for >>: 'str' and 'file'
> >>>
> Am I misinterpreting Section 6.6 of the language doc?
> 
> I get a similar result with Python or PythonWin.

The synax is

	print >> f, 'abc'

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Money talks / But love is for real / And you know that
\__/ Neneh Cherry
    Erik Max Francis' bookmarks / http://www.alcyone.com/max/links/
 A highly categorized list of Web links.



More information about the Python-list mailing list