如何捕获 clojure 的标准输出? [英] How can I capture the standard output of clojure?
本文介绍了如何捕获 clojure 的标准输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从 Clojure 程序中捕获一些 printlns,我想知道如何捕获输出?
I have some printlns I need to capture from a Clojure program and I was wondering how I could capture the output?
我试过了:
(binding [a *out*]
(println "h")
a
)
:但这不起作用
推荐答案
(with-out-str (println "this should return as a string"))
这篇关于如何捕获 clojure 的标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文