Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Two-dimensional hash in perl and python two-dimensional dictionary dict
Two-dimensional hash in perl and python two-dimensional dictionary dict
(1) 1. dict, a two-dimensional code dictionary, is stored and read in python; This is a way to store dictionaries in a nested way.

The output content is:

Perl is not as convenient as python, and it involves a dictionary of two-dimensional hash, so it needs to explain a writing method. There are many ways to write in perl.

akin

Knowing key 1, the way to dereference key2 is actually to convert hashref(ARRAY(0x 1dd97f0)) into a real hash embedded in the target, and for the result of python, get hash {'bbb': 'value'}.

The supplementary solution is to put the following symbol in front of the variable whose content is reference, that is, to turn this reference into this type.

% stands for the whole hash hash, and {} stands for (python dict).

@ stands for the whole array array, [] stands for (python list).

$ stands for scalar (a common variable in python)

& stands for a subfunction (def function in python)

Others can also be used directly-> symbolic solution

Supplementary test

The content returned is:

Reference:

Reference and dereference in Perl

Perl-–Traverse a two-dimensional hash