# How To Use Dictionary instead of List if using FOR loop

**URL:** <https://forum.robotframework.org/t/how-to-use-dictionary-instead-of-list-if-using-for-loop/5660>\
**Category:** Robot Framework\
**Created:** [7 May 2023 07:43 UTC](https://forum.robotframework.org/t/how-to-use-dictionary-instead-of-list-if-using-for-loop/5660 "2023-05-07T07:43:16Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [8 May 2023 00:48 UTC](https://forum.robotframework.org/t/how-to-use-dictionary-instead-of-list-if-using-for-loop/5660/7 "2023-05-08T00:48:52Z")

</div>

Looks to be in part a duplicate (for which I replied and then seen the post here after)

Ref:

> [@How to use dictionary instead of of list in robot framework](https://forum.robotframework.org/t/how-to-use-dictionary-instead-of-of-list-in-robot-framework/5662/2):
>
> Basically as the error reads, Its saying it doesn’t contain key ‘1’ Which ${element} will in your case equal either 1 or a number from that upto your list count+1 variable you’ve provided (your examples above don’t show the value assigned to these or how the count is returned) the line from above: FOR ${element} IN RANGE 1 ${total\_list\_count}+1 as that’s the value your giving the kw to get from the dictionary: ${key}= Get From Dictionary ${text\_dict} ${element} for which if there…

---

_[View the full topic](https://forum.robotframework.org/t/how-to-use-dictionary-instead-of-list-if-using-for-loop/5660)._
