# Help with DICT of LISTS

**URL:** <https://forum.robotframework.org/t/help-with-dict-of-lists/9404>\
**Category:** Robot Framework\
**Created:** [12 November 2025 19:35 UTC](https://forum.robotframework.org/t/help-with-dict-of-lists/9404 "2025-11-12T19:35:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leam](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/leam/32/4790_2.png) [@Leam](https://forum.robotframework.org/u/Leam)\
**Post date:** [12 November 2025 19:35 UTC](https://forum.robotframework.org/t/help-with-dict-of-lists/9404/1 "2025-11-12T19:35:40Z")

</div>

I’m trying to create a DICT of LISTs, but not getting the sigils and syntax right yet. For example a DICT of FRIENDS, with each element being a CITY with a list of friends in it.

```python
friends = { 
    'brescia': ["Marco", "Davide"],
    'albany': ['Willie', 'Jim'],
    'st marys': ['Kenn'],
    'maryland': ['Pat and Patrick', 'Shannon'],
}
 
city = 'brescia'
for friend in friends[city]:
    print(friend)

```

So this would print “Davide” and “Marco”. How do I do that in RobotFramework?

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [12 November 2025 20:09 UTC](https://forum.robotframework.org/t/help-with-dict-of-lists/9404/2 "2025-11-12T20:09:40Z")

</div>

Hi,

Global idea would be this, having the lists built then included in the Dict:

```
VAR @{brescia} Marco Davide
VAR @{albany} Willie Jim
VAR @{st marys} Kenn
VAR @{maryland} Pat and Patrick Shannon
VAR &{friends} brescia=${brescia} albany=${albany} st marys=${st marys} maryland=${maryland}

VAR ${city} brescia
FOR ${friend} IN @{friends}[${city}]
    Log ${friend}
END 

```

This will log Marco and Davide 🙂

Regards.  
Charlie

---

<div class="post-metadata">

**Author:** ![FrancisG](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/francisg/32/4247_2.png) [@FrancisG](https://forum.robotframework.org/u/FrancisG)\
**Post date:** [13 November 2025 06:51 UTC](https://forum.robotframework.org/t/help-with-dict-of-lists/9404/3 "2025-11-13T06:51:09Z")

</div>

If for some reason, you don’t want to pre-define the lists first, you can use [Inline Python evaluation](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#toc-entry-352) as well:

```python
***Test Cases***
Test Case 1
    VAR &{friends}   
    ... brescia=${{["Marco", "Davide"]}}
    ... albany=${{['Willie', 'Jim']}}
    ... st marys=${{['Kenn']}}
    ... maryland=${{['Pat and Patrick', 'Shannon']}}
    VAR ${city} brescia

    FOR ${friend} IN @{friends}[${city}]
        Log To Console ${friend}
    END

```
