title: printing output as a table in python terminal and saving output as a .txt with proper headings
body: <p>I have written a code to find approximated sum of an exponential function, which should run iteration till N-1 terms, then return the iteration no, sum, abs error and relative error for each iteration step. </p>
  
  <pre><code>from __future__ import division
  import numpy as np
  import matplotlib.pyplot as plt
  import math
  
  N = input ("Please enter an integer at which term you want to turncate your summation")
  x = input ("please enter a number for which you want to run the exponential summation e^{x}")
  
  
  function= math.exp(x)
  exp_sum = 0.0
  abs_err = 0.0
  rel_err = 0.0
  
  
  for n in range (0, N):
      factorial = math.factorial(n)
      power     = x**n
      nth_term  = power/factorial
      exp_sum   = exp_sum + nth_term
      abs_err   = abs(function - exp_sum)
      rel_err   = abs(abs_err)/abs(function)
  
  
      print "The exponential function which has %d-term expansion, returns the approximated sum to be %.16f." % (n, exp_sum)
      print "This approximated sum has an absolute error to be %.25f" % abs_err
      print "and a relative error to be %.25f" % rel_err
  </code></pre>
  
  <p>right now, it actually looks silly printing values at each iteration and it only looks good till a few iteration, my plan is to get the output as a   table with proper column headings (iteration, sum, abs err, rel err) in the terminal after I execute the .py file.</p>
  
  <p>also I wish to save a .txt file of the output, if anyone has idea how to do that in python, I would very much appreciate the help and thanks.</p>