[Tutor] How to print to a file?

Karl Pflästerer sigurd at 12move.de
Wed Feb 18 16:35:09 EST 2004


On 18 Feb 2004, denny <- libsvm at tom.com wrote:

> I want to write something to a file like this:
> print >>filehandle, "....%d...%s..."%(num,string)
> but it raise error

Without seeing the error noone can tell you what might be the reason.


> Can someone tell me how can I print it above to a file just like
> we print to the stdout(print "....%d...%s..."(num,string)).
> Or is there some funtion as we use in C/C++( fprint etc)

>>> f = open("foo","w")
>>> print >> f, "Test"
>>> f.close()
>>> 



   Karl
-- 
Please do *not* send copies of replies to me.
I read the list




More information about the Tutor mailing list