Nodes/ComfyUI_Eugene_Nodes/Dictionary Multiline Select
ComfyUI Node

Dictionary Multiline Select

Grab One Line From a Wall of Text and Stash It in a Dictionary

By JEONG-JIWOO·Created 2 years ago·Updated 8 months ago· 2
Dictionary Multiline Select
  • input_dict
  • DICT
  • INT
line_number0
multiline_text
key_string

Some of the most useful text in ComfyUI arrives as one big multiline block - a list of style names, a batch of prompt candidates, a set of negative tags you keep around. The Dictionary Multiline Select node does one thing: pull a single line out of that block by number and drop it into your dictionary under a key you choose. It's a narrow tool, but when you need to pick one item out of a list programmatically, it's exactly the tool.

How it works

Four required inputs, zero options:

  • input_dict - the dictionary you're building on (it gets copied, so the original isn't mutated).
  • multiline_text - the wall of text you're selecting from, one candidate per line.
  • line_number - which line to grab. Line 0 is the first line. This trips everyone up once; the node counts like a programmer, not like a human reading "1, 2, 3."
  • key_string - the dictionary key the selected line is stored under.

The selected line gets whitespace-stripped and written to the dictionary as result_dict[key_string] = line. Outputs are the updated DICT and the INT line number you selected (handy for feeding downstream logic or just verifying what ran).

The one sharp edge lives in the source: if line_number is greater than or equal to the number of lines in the text, the node raises an error - "Line number X is out of range." No silent fallback. If your multiline block can vary in length, you need to keep the line number in range yourself (for instance, by checking the line count first).

Where it fits

The natural use is prompt rotation: a multiline box holding several style variants, a fixed line_number you tweak to choose which one runs, and the result flowing into a DictTemplate's {style} placeholder. Change the number, get a different prompt, same graph. It also plays nicely with the dictionary-at-the-top pattern - the selected line becomes just another token the rest of the workflow reads.

Installing it

Same pack, no dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/JEONG-JIWOO/ComfyUI_Eugene_Nodes

Restart ComfyUI, or install via ComfyUI Manager (search "Eugene Nodes").

Where people get burned

The zero-based indexing is the number one surprise - line_number 1 does not grab the first line. Second is the out-of-range error: it's loud and it's real, so keep your line count in mind when editing the text block. And as always in this pack, the DICT output only connects to this pack's dictionary inputs - from here, that usually means DictTemplate or a LoRA loader's input_dictionary.

Categorydictionary/utils

Inputs (4)

NameTypeDefaultDescription
input_dictDICT
line_numberINT00–9999
multiline_textSTRING
key_stringSTRING

Outputs (2)

NameTypeDescription
DICTDICT
INTINT