ComfyUI Node

get multiple

Fetch several dict values in one shot — keys in, a values list out

By StableLlama·Created about a year ago·Updated 4 days ago· 48
get multiple
  • input_dict
  • keys
  • default
  • values

"get multiple" retrieves several values from a dictionary in one go: you feed it a LIST of keys, and it returns a LIST of values, one per key, in the same order. It's the batch version of get - instead of wiring four get nodes to pull four fields, you pull them all at once and get a list back that's ready for list-based processing.

Where get is for "I need this one field right here," get multiple is for "I need a handful of fields, aligned in a predictable order, as a collection." That makes it the natural fit when the values are headed to a list consumer - a formatter, a batch node, a display - or when you want to reorder a dict's values by naming the keys in the order you want them.

How it works

  • input_dict (DICT) - the dictionary to read from.
  • keys (LIST) - the keys to fetch, in the order you want them back.
  • default (*, optional) - the fallback for any key that's missing.
  • Output: values (LIST) - one value per requested key, same order.

Under the hood it's a list comprehension over your keys using dict.get(), so missing keys don't crash - each miss returns the default, or None if you didn't provide one.

The important details

  • Order is yours. The output list mirrors your keys input, not the dict's insertion order. Ask for ["c", "a"] and you get [c_value, a_value]. That's a feature when you're reordering, and a trap if you assumed the dict's natural order.
  • Alignment matters. This gives you a list of values with no key labels attached. If you pair it with the original keys list downstream, you have key-value pairs; if you lose track of which value is which, you have a mystery list. The items node is the labeled alternative.
  • A missing key without a default yields None in that position - the list stays the same length as your key list, always. That predictability is exactly why you'd use this over chained get nodes.

When to use it

Reordering, subsetting, and bulk extraction: pull a handful of fields into a list in the order a downstream node wants, defaulting the ones that might not exist. It pairs well with create from LISTs to rebuild a reordered dict, and with anything list-shaped that needs your dict's values.

Install

Part of 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.

CategoryBasic/DICT

Inputs (3)

NameTypeDefaultDescription
input_dictDICT
keysLIST
defaultopt*

Outputs (1)

NameTypeDescription
valuesLIST