How do modify dict elmement? #2435
-
Given dict in python |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I bet you can figure this one out on your own pretty easily. Consider: how do you write |
Beta Was this translation helpful? Give feedback.
-
I was also trying to use dictionary, but couldn't figure out the equivalent of python dict's (setv a #{1 2 3 4}) a #{1 2 3 4} (print a) {1, 2, 3, 4} => (get a 3)
Traceback (most recent call last):
File "stdin-8d3522acff2f2f4b569e9551e76ef8e5bbb56269", line 1, in <module>
TypeError: 'set' object is not subscriptable
=> (get a "3")
Traceback (most recent call last):
File "stdin-ee295049c0d832ca7a5417ea612647e2a70c6382", line 1, in <module>
TypeError: 'set' object is not subscriptable Also note the weird order here: (setv a #{"1" 2 "3" 4}) a #{"3" 2 "1" 4} (print a) {'3', 2, '1', 4} => (print (get a "3"))
Traceback (most recent call last):
File "stdin-8b322e50ba4b8c8af946bb5553aa07dacbdd0e56", line 1, in <module>
TypeError: 'set' object is not subscriptable |
Beta Was this translation helpful? Give feedback.
Try
(setv (get obj "a" "c") 2)
.