On Fri, Oct 02, 2020 at 09:25:58PM +0100, Shaozhong SHI wrote:
> Hi, All,
> 
> I was trying to handle the value of  "personRoles" in a part of json
> dictionary.
> 
> Can anyone tell me various ways to handle this?

I'm not sure if I understand what you're asking, but if I do, then...
you handle it just as you would handle any other list.  The only
difference is that instead of something like "my_list", the name of
the list is d['regulatedActivities']['contacts']['personRoles'].

  https://docs.python.org/3/tutorial/datastructures.html
 
Then:

> f = d['regulatedActivities']['contacts']['personRoles']

After this executes, you have an alias for that list called "f" that
refers to the same list object instance...  So you can do all the
things you can do to a list, and refer to it either as f or as
d['regulatedActivities']['contacts']['personRoles'] when you do so.
It is an alias, not a copy, so if you change one, you change the
other.

HTH.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to