如何从 Julia 字典中获取空条目?

log*_*ick 2 julia

我定义了一些字典,其中可能包含空值。有没有一种快速方法可以检查我的键值对是否包含空条目?

julia> a = Dict(1=>[1,2], 4=>[3,4], 6=>[])
Dict{Int64, Vector{T} where T} with 3 entries:
  4 => [3, 4]
  6 => Any[]
  1 => [1, 2]

Run Code Online (Sandbox Code Playgroud)

Bog*_*ski 6

您想要一种快速的方法,因此我建议:

findall(isempty, a)
Run Code Online (Sandbox Code Playgroud)