How to update a nested dictionary in DolphinDB?

17 views Asked by At

I'm trying to update values within a nested dictionary in DolphinDB, as shown in the following scipt:

d1 = dict( STRING, ANY )
d2 = dict( STRING, ANY )

d2[`d2_K] = 1
d1[`d1_K] = d2
d2[`d2_K] = 3

But an error occurs: Syntax Error: [line #1] Cannot recognize the token objAddress.

1

There are 1 answers

0
molddd123 On BEST ANSWER

You need to use an intermediate variable for assignment:

tmp = d1[`d1_K]
tmp[`d2_K]=3
d1[`d1_K]=tmp