redirect nprint output to file

4 views
Skip to first unread message

archeryguru2000

unread,
Aug 20, 2009, 12:02:01 PM8/20/09
to mpmath
Another question for the mpmath geniuses. I typically use the
following command when I want to throw the output of my python script
to some text file.

filename = open('some-file.dat', 'w')
print >>filename, "something"

Is there a similar command with the nprint call, say

filename = open('some-file.dat', 'w')
nprint("some mpmath function", write=filename)


Thanks again,
~~archery~~

Vinzent Steinberg

unread,
Aug 21, 2009, 5:35:12 AM8/21/09
to mpmath
No, use nstr() for this. nprint() is currently only a trivial wrapper
to nstr() for lazy people who do not want to type "print nstr(...)".
But feel free to extend it and send a patch. :)

Vinzent

Vinzent

archeryguru2000

unread,
Aug 21, 2009, 10:03:08 AM8/21/09
to mpmath
Thanks for the quick response (again) Vinzent. I was not aware of
nprint being a wrapper for nstr(), I assumed they were two independent
functions. I'll bet if I would've fully read the documentation, I
would have seen this somewere. :)

By the way, I like your recruitment style.
<But feel free to extend it and send a patch>

Anyway, thanks for the information. I'll see what I can do with this.

Thanks,
~~archery~~
Reply all
Reply to author
Forward
0 new messages