Can you get the keys from a Value List?



Hi, I’d like to use both the keys and values of value list.


What is the best way to do this?



(qythium) #3
valuelist = ghenv.Component.Params.Input[0].Sources[0]
keys, values = zip(*[(item.Name, item.Expression) for item in valuelist.ListItems])

image (6.1 KB)


Fantastic, thank you!


When I viewed the output of the Value List, is was just the values, so I wasn’t sure how to get it. But programatically ripping open the input component is a great solution. Thanks!