如何在Julia中不打印类型? [英] How to not print types in Julia?
本文介绍了如何在Julia中不打印类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有一个数字数组:
If I have an array of numbers:
a = [1,2,3]
并打印它,我得到
[1,2,3]
但是如果我有一个数组,例如Tuples:
but if I have an array of, say, Tuples:
b = [(1,2),(3,)]
我打印时得到:
Tuple{Int64,Vararg{Int64}}[(1,2),(3,)]
如何避免打印类型?
推荐答案
它不能被抑制.
julia> b = [(1,2), (3,)]
2-element Array{Tuple{Int64,Vararg{Int64}},1}:
(1,2)
(3,)
也许正在打印该类型,以显示您正在包含Vararg
类型.
Maybe the type is being printed to show you that you are including a Vararg
type.
如果您希望输出不带消息的内容,则可以继续为 Base.show
If you want an output without the message, you can go ahead and write a wrapper for Base.show
这篇关于如何在Julia中不打印类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文