For example,
nt = (a=1,b="b",c=5.0)
How do I get the names of nt
which are [:a,:b,:c]
?
As for any other key-value structure (like a dictionary), you can use the keys
function:
julia> nt = (a=1,b="b",c=5.0)
(a = 1, b = "b", c = 5.0)
julia> keys(nt)
(:a, :b, :c)
Note that in general this returns an iterator over the keys. If you really want to materialize it collect
the result:
julia> collect(keys(nt))
3-element Array{Symbol,1}:
:a
:b
:c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With