Nodes/Comfy UI Text List Product/Multiline String to List
ComfyUI Node

Multiline String to List

Prompt ideas, one per line — and this time they actually become a list

By opvelll·Created 2 years ago·Updated 8 days ago· 1
Multiline String to List
    • list
    text
    trim_whitespacetrue
    keep_empty_linesfalse

    The name is the whole spec: you paste a multiline string in, you get a real Python list[str] out - one item per line. Sounds trivial, but it's the front door to this entire pack, which is built around one genuinely useful idea: instead of hand-typing every prompt combination, you type prompt parts as lines and let the cartesian product do the multiplying.

    Here's the setup. You want eight images - two characters, two hair colors, two locations. The naive way is to write all eight prompts. The ComfyUI way, once you've got this pack, is three groups of lines and a product node. MultilineStringToList is what turns each group of lines into a structure the product nodes can chew on.

    How it works

    Under the hood it's about as simple as it gets: text.splitlines(), then optionally strip each line, then optionally drop the empties. Three things you should know because they'll bite you eventually:

    • It handles LF, CRLF, and CR line endings. Paste from anywhere, it just works.
    • trim_whitespace is on by default - leading/trailing spaces vanish, and a whitespace-only line becomes empty and then disappears.
    • keep_empty_lines is off by default, so blank lines are dropped rather than kept as empty-string items. Empty input returns an empty list - not an error. Save that thought for troubleshooting below.

    Also nice: lines that look like comments (# foo, // bar) are kept as plain text. No surprise filtering of your actual prompt content.

    The inputs and outputs that matter

    There are exactly three inputs, and honestly you'll only touch one:

    • text - the multiline string you split. This is the one you type in.
    • trim_whitespace - default true. Leave it unless you genuinely need trailing spaces in a prompt (you almost never do).
    • keep_empty_lines - default false. Flip it on only if an empty string is a meaningful member of your list, which matters for the "WithSingle" shortcut nodes in this pack that simulate optional prompt parts.

    The single output is list, typed LIST. That's the pack's own custom container, and it travels through the workflow as one value. A list of five strings is still one thing on the wire - it will not fan out into five executions by itself. That's not a bug; that's what Text List to Sequence exists for.

    Where it goes next

    Straight out of the box: MultilineStringToList → TextListProduct (as list_a or list_b) or into ProductedString to get every combination as one big multiline string you can save to a text file. If you want each combination to actually generate, keep going: … → TextListToSequence → CLIP Text Encode. The README's own example chain is exactly that.

    The pack's list inputs are also happy with compatible LIST outputs from other suites - the author calls out WAS Node Suite specifically, so you can mix and match.

    Installing it

    Nothing special, and that's the good news - this is a pure-Python pack, no requirements.txt, no model downloads, no weights. Via ComfyUI Manager, hit "Install Custom Nodes" and search "Comfy UI Text List Product". Or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/opvelll/ComfyUI_TextListProduct
    

    Then restart ComfyUI. It's MIT-licensed and ships with a unittest suite, which is more than most utility packs bother with.

    Where people get burned

    The classic mistake is feeding an empty list downstream and wondering why nothing happens. Blank text box → empty list → a product node with an empty list produces zero combinations, and if you've got a TextListToSequence after that, it raises a clear error rather than silently doing nothing. The other common surprise is expecting the LIST socket to behave like ComfyUI's batch inputs and auto-expand. It doesn't - you chose that explicitly at the end of the chain with the sequence node. Type your lines, feed the product, convert to sequence when you actually want per-item runs.

    CategoryTextListProduct

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    trim_whitespaceBOOLEANtrue
    keep_empty_linesBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    listLIST