title: How to write the output of ipython command in python text file?
body: <p>I want to capture the output of the following ipython command into a file:
  commands and outputs areas follows:</p>
  
  <pre><code>`decoder.get_hyp()`
  
  WARNING: "ngram_search.c", line 1000: &lt;/s&gt; not found in last frame, using ++NOISE++ instead
  INFO: ngram_search.c(1046): lattice start node &lt;s&gt;.0 end node ++NOISE++.171
  INFO: ps_lattice.c(1225): Normalizer P(O) = alpha(++NOISE++:171:185) = -2003082
  INFO: ps_lattice.c(1263): Joint P(O,S) = -2036704 P(S|O) = -33622
  Out[7]: ('WELCOME TO MY TALK', '000000000', -36704586)
  </code></pre>
  
  <p>I want to capture only the part "wellcome to my talk" into my file.</p>