on 06-24-2014 10:39 AM
Hi. I'm wondering is there a simple method to change only the one value of a dict type variable without touching any other values? In the enclosed example (Untitled.png) assign state seems to delete other than listed values. In other words: how can I change or append data to the {IVRINFO} without sweeping it's current content? Thanks for any advices.
Hi Krzysztof,
you could try using one of the below approaches.
1. Setting all the dictionary values each time, but using str(dict['key']) to store the current value of a key you don't want to change:
In the example, only TestDict["NumberInfo"] would be modified.
2. Using the dictionary update method, via a temp variable (var or assign):
The example updates TestDict2["Key2"] to "oof" and leaves other dictionary content intact.
For example, before TestDict2 = {'Key1': 'foo', 'Key2': 'bar'}, after {'Key1': 'foo', 'Key2': 'oof'}.
By using the first approach, you will know the exact dictionary contents after the assign state. With the latter one, on the other hand, you don't need to know/check the dictionary contents before updating and will not accidentally overwrite other values.
Hope you get your IVR working.
Regards,
-Lasse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.