How to save output calculation in 2 columns in simple txt file?    
   Dear All,
I am trying to do a simple calculation with sage:
var('x')
for a in [0..10,step=2]:
     func=numerical_integral(cos(a*x),0,1)[0]
     print a, func
As you can see, the output in sage is written in 2 column. Firs column the number A and the second is the result of calculation:
0  1.0
2  0.454648713413
4  -0.189200623827
6  -0.0465692496998
8  0.123669780828
10 -0.0544021110889
How is it possible to save tow-column result in a simple txt file as it is shown in above? Just number and no any array, no any comma! Just number. I have came across huge documentation in ask.sagemath.org, Sage manual with such offering such as open("example.txt","w") and even with python commands! No result I could get. For example:
var('x')
f=open("/tmp/my2.dat", "w")
for a in [0..10,step=2]:
     func=numerical_integral(cos(a*x),0,1)[0]
     print a, func
f.close()
The question is I don't know how to put PRINT OUTPUT in my2.dat file as two column in above code? I have read somewhere that it is possible by the following python command:
var('x')
with open("/tmp/my2.dat", "w") as out:
      for a in [0..10,step=2]:
            func=numerical_integral(cos(a*x),0,1)[0]
      print a, func >> out, line
f.close (or implicit_close)
No reslut and with error. Please If some one has a practical suggestion to my first code, let me know about that. I don't want use the commercial MATHEMATICA and so on! I just want to use only SAGE and SAGE!
Thank you.
 
  
 