get keys values
Split a dict into its keys and values — two parallel lists out
- input_dict
- keys
- values
"get keys values" takes a dictionary and hands you back two lists: all the keys, and all the values, as parallel LISTs. It's the deconstruction half of the pack's dict tooling - create DICT builds, this tears apart. If you need to iterate a dict's fields in list form, hand its keys to a selector, or reorder its values, this is the node that gets you from dict-world to list-world.
Because dicts in Python are ordered (insertion order, guaranteed since 3.7), the two output lists line up positionally: keys[0] matches values[0]. That alignment is the entire deal - break it and the pairing is meaningless.
How it works
One input, two outputs:
input_dict(DICT) - the dictionary.- Output
keys(LIST) - the key names, in insertion order. - Output
values(LIST) - the corresponding values, in the same order.
The node calls list(dict.keys()) and list(dict.values()) under the hood. Simple, deterministic, and the two lists are guaranteed to be the same length and aligned.
Where it fits
- Round-trips: split a dict, filter or reorder one list, then rebuild with
create from LISTs. That node pairs keys with values position by position, which is exactly this node's inverse. - List-based tooling: many nodes in this pack speak LIST, not DICT. If you want to sort by key, feed the keys list to a sort node, then rejoin. Same for values.
- Inspection: dump both lists into a display or text node to eyeball what a dict actually contains - a quick and dirty debug move.
Gotchas
- The alignment is only meaningful if you keep the lists paired. Reorder
valueswithout reorderingkeysand your rebuild produces a garbage dict. Either reorder both identically, or prefer the pair-baseditemsnode (which keeps each key-value pair together) when order manipulation is involved. - If you only need the keys (or only the values), the dedicated
keysandvaluesnodes are slightly less overhead - this one is for when you want both halves of a dict in one shot.
Install
Ships in Basic data handling - pure Python, zero dependencies, no model downloads. ComfyUI Manager → search "Basic data handling", or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart ComfyUI. Small node, but it's the cleanest bridge between dict-land and list-land in the pack.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_dict | DICT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| keys | LIST | — |
| values | LIST | — |