首页 > 解决方案 > Julia v0.6: loaded JLD file does not show full contents

问题描述

(Still) new to julia so bear with me. I have a file Pkg.jld that was saved with package versions from a julia v0.6 installation. I have the correct JLD installed but when I execute load("<path>/Pkgs.jld")["data"] the output is cut off. It prints

Dict{String,VersionNumber} with 139 entries:
  "FFTW"                 => v"0.0.4"
  "Gtk"                  => v"0.14.0"
  ... (more packages)
  :                      => :

but it shows less than the claimed 139 entries. How can I see all the entries in the encoded dictionary?

标签: julia

解决方案


您应该通过以下方式获取所有条目

show(stdout, "text/plain", yourdict)

例子:

julia> using Pkg; somedict = Pkg.installed()
Dict{String,Union{Nothing, VersionNumber}} with 61 entries:
  "FFTW"                 => v"0.2.4"
  "ForwardDiff"          => v"0.10.0"
  "Arpack"               => v"0.3.0"
  "Measurements"         => v"1.0.2"
  "Juno"                 => v"0.5.3"
  "EllipsisNotation"     => v"0.3.0"
  "HTTP"                 => v"0.7.1"
  "NPZ"                  => v"0.3.0"
  "DataStructures"       => v"0.14.0"
  "Latexify"             => v"0.5.1"
  "SimpleWeightedGraphs" => v"1.1.0"
  "PeriodicTable"        => v"0.1.2"
  "JLD2"                 => v"0.1.2"
  "Knet"                 => v"1.1.1"
  "DataFrames"           => v"0.14.1"
  "Distributions"        => v"0.16.4"
  "Helpers"              => v"0.0.0"
  "TimerOutputs"         => v"0.4.0"
  "IterativeSolvers"     => v"0.7.1"
  "HDF5"                 => v"0.10.2"
  "Humanize"             => v"1.0.0"
  "LsqFit"               => v"0.6.0"
  ⋮                      => ⋮

julia> show(stdout, "text/plain", somedict)
Dict{String,Union{Nothing, VersionNumber}} with 61 entries:
  "FFTW" => v"0.2.4"
  "ForwardDiff" => v"0.10.0"
  "Arpack" => v"0.3.0"
  "Measurements" => v"1.0.2"
  "Juno" => v"0.5.3"
  "EllipsisNotation" => v"0.3.0"
  "HTTP" => v"0.7.1"
  "NPZ" => v"0.3.0"
  "DataStructures" => v"0.14.0"
  "Latexify" => v"0.5.1"
  "SimpleWeightedGraphs" => v"1.1.0"
  "PeriodicTable" => v"0.1.2"
  "JLD2" => v"0.1.2"
  "Knet" => v"1.1.1"
  "DataFrames" => v"0.14.1"
  "Distributions" => v"0.16.4"
  "Helpers" => v"0.0.0"
  "TimerOutputs" => v"0.4.0"
  "IterativeSolvers" => v"0.7.1"
  "HDF5" => v"0.10.2"
  "Humanize" => v"1.0.0"
  "LsqFit" => v"0.6.0"
  "Polynomials" => v"0.5.1"
  "ProgressMeter" => v"0.6.1"
  "GPUArrays" => v"0.5.0"
  "ApproxFun" => v"0.9.0"
  "DistributedArrays" => v"0.5.1"
  "CSV" => v"0.4.2"
  "Revise" => v"0.7.12"
  "Atom" => v"0.7.6"
  "BenchmarkTools" => v"0.4.1"
  "Optim" => v"0.17.1"
  "ReverseDiff" => v"0.3.1"
  "LinearOperators" => v"0.5.1"
  "PyCall" => v"1.18.5"
  "Traceur" => v"0.2.0"
  "BandedMatrices" => v"0.5.2"
  "DataFramesMeta" => v"0.4.0"
  "JSON" => v"0.19.0"
  "StatsBase" => v"0.25.0"
  "IJulia" => v"1.13.0"
  "Flux" => v"0.6.8"
  "PyPlot" => v"2.6.3"
  "Unitful" => v"0.12.0"
  "StaticArrays" => v"0.9.2"
  "DifferentialEquations" => v"5.3.1"
  "Parameters" => v"0.10.1"
  "UnicodePlots" => v"0.3.1"
  "OnlineStats" => v"0.19.2"
  "BlockBandedMatrices" => v"0.1.1"
  "LightGraphs" => v"1.2.0"
  "LinearMaps" => v"2.2.1"
  "Query" => v"0.10.1"
  "LaTeXStrings" => v"1.0.3"
  "Rebugger" => v"0.1.4"
  "OhMyREPL" => v"0.3.0"
  "ProfileView" => v"0.4.0"
  "AbstractTrees" => v"0.2.0"
  "BlockArrays" => v"0.4.1"
  "QuantumOptics" => v"0.6.1"
  "Gtk" => v"0.16.4"

这在 Julia v1.0.1 上,但基本上也应该在 v0.6 上工作(删除using Pkg并替换stdout-> STDOUT)。


推荐阅读