Input as list


#1

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?


#2

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

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:

p = eval(population)
print p[0]

or the first item in the first dictionary:

print p[0]['a']

maybe @piac nows a more elegant way ?

c.


#3

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