# Input as list

**URL:** <https://discourse.mcneel.com/t/input-as-list/42277>\
**Category:** Grasshopper Developer\
**Created:** [March 16, 2017, 9:14pm UTC](https://discourse.mcneel.com/t/input-as-list/42277 "2017-03-16T21:14:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nazanin\_tabatabaei](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nazanin_tabatabaei/32/62640_2.png) [@nazanin\_tabatabaei](https://discourse.mcneel.com/u/nazanin_tabatabaei)\
**Post date:** [March 16, 2017, 9:14pm UTC](https://discourse.mcneel.com/t/input-as-list/42277/1 "2017-03-16T21:14:29Z")

</div>

hello,  
I am trying to input a list of dictionaries to my python component. however I don’t know how to make it understand that the type is a list,so it can iterate through it.any thoughts?

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/759176_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [March 17, 2017, 10:34pm UTC](https://discourse.mcneel.com/t/input-as-list/42277/2 "2017-03-17T22:34:26Z")

</div>

@nazanin_tabatabaei, i’ve tried below and it seems to work:

 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/1/3162c991b163a2edb3c3c9e8aaafe37ceaff54ad.png)

for the python component, right click on population and set it to “item access”, the type hint is set to “str”. So inside the component, the variable `population` is of type `str`. Then convert the string to code using `eval` and access the first dictionary in the list:

```python
p = eval(population)
print p[0]

```

or the first item in the first dictionary:

```python
print p[0]['a']

```

maybe @piac nows a more elegant way ?

- 

c.

---

<div class="post-metadata">

**Author:** ![nazanin\_tabatabaei](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nazanin_tabatabaei/32/62640_2.png) [@nazanin\_tabatabaei](https://discourse.mcneel.com/u/nazanin_tabatabaei)\
**Post date:** [March 18, 2017, 4:32pm UTC](https://discourse.mcneel.com/t/input-as-list/42277/3 "2017-03-18T16:32:57Z")

</div>

thank you, I did it the hardway,by spliting the string!
