If I have the following dictionary...
location_ids: =
{
'2c50b449-416e-456a-bde6-c469698c5f7': ['422fe2d0-b10f-446d-ac3c-f75e5a3ff138'],
'61df50b6-3b50-4f22-a175-404089b2ec4f': ['7112fa59-63b1-4057-8822-fe11168c328f']
}
... and what I want to do is get a list of the values from the lists in one list.
At the mo, I can do something like:
locations = [location_ids[i] for i in location_ids]
which returns a list of lists:
[
['422fe2d0-b10f-446d-ac3c-f75e5a3ff138'],
['7112fa59-63b1-4057-8822-fe11168c328f']
]
But, how can I change my code to just give me a list of the values like this:
['422fe2d0-b10f-446d-ac3c-f75e5a3ff138', '7112fa59-63b1-4057-8822-fe11168c328f']
I'm hoping as well, if I have more than one id in a values list, like this:
locations_id = {
'2c50b449-416e-456a-bde6-c469698c5f7': ['422fe2d0-b10f-446d-ac3c-f75e5a3ff138','d45ec64a-b41a-41d5-bd47-eed27c6dfd82'],
'61df50b6-3b50-4f22-a175-404089b2ec4f': ['7112fa59-63b1-4057-8822-fe11168c328f']
}
how can I expand my code to give me:
[
'422fe2d0-b10f-446d-ac3c-f75e5a3ff138',
'd45ec64a-b41a-41d5-bd47-eed27c6dfd82',
'7112fa59-63b1-4057-8822-fe11168c328f'
]