Can you get the keys from a Value List?

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

vlist

What is the best way to do this?

copy/paste?

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

image
valuelist-extract.gh (6.1 KB)

3 Likes

Fantastic, thank you!

vlist

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!