
我有一个使用子进程来获取HTML的脚本:
misha@misha-K42Jr:~/git/domain_classifIEr$python webkit_retrIEve.py error-cut.txt HTML/error -N 5http://kurabo.co.jp HostNotFoundErrorhttp://monarch.com HostNotFoundErrorhttp://nssmgmt.com HostNotFoundErrorhttp://sbcglobal.net HostNotFoundErrorhttp://dynamixcorp.com SslHandshakeFailedErrorhttp://groupe-synox.com RemoteHostClosedErrorQFont::setPixelSize: Pixel size <= 0 (0)http://www.cnn.com NoErrorhttp://pacbell.net TimeoutError
如果我运行相同的脚本,但将输出重定向到文件,我在输出中什么也得不到:
misha@misha-K42Jr:~/git/domain_classifIEr$python webkit_retrIEve.py error-cut.txt HTML/error -N 5 > stdout.txtQFont::setPixelSize: Pixel size <= 0 (0)misha@misha-K42Jr:~/git/domain_classifIEr$cat stdout.txtmisha@misha-K42Jr:~/git/domain_classifIEr$
为什么输出空?它不应该包含在第一种情况下打印到stdout的相同内容吗?
解决方法 使用&>对于重定向,这应该将stdout和stderr重定向到指定的文件 总结以上是内存溢出为你收集整理的linux – 将stdout重定向到无法正常工作的文件全部内容,希望文章能够帮你解决linux – 将stdout重定向到无法正常工作的文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)