Julia REPL根据终端的窗口大小截断输出。例如,在10行高的窗口中,我得到以下输出:
julia> collect(1:50)
50-element Array{Int64,1}:
1
2
3
⋮
49
50
julia>
如何防止REPL截断输出?
答案 0 :(得分:3)
一种方法是使用命令repr
(它将结果显示为字符串):
julia> repr(collect(1:50))
"[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]"
另一种方法是使用命令show
:
julia> show(collect(1:50))
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,3
0,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]
使用Julia Version 0.4.3进行测试
答案 1 :(得分:2)
目前,使用Julia版本1.4.1,正确的方法是使用@show。分号禁止打印截断的版本:
julia> @show collect(1:50);
collect(1:50) = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,3
0,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]