我想将以下 ipython 命令的输出捕获到文件中:
命令和输出区域如下:
`decoder.get_hyp()`
WARNING: "ngram_search.c", line 1000: </s> not found in last frame, using ++NOISE++ instead
INFO: ngram_search.c(1046): lattice start node <s>.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)
我只想将“欢迎参加我的演讲”部分捕获到我的文件中。
使用IPython魔法函数store http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html
%store foo >a.txt # Store (overwrite) value of foo to file a.txt
%store foo >>a.txt # Append value of foo to file a.txt
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)