Nodes/ComfyUI_Accessories/Make List From Text
ComfyUI Node

Make List From Text

Make List From Text turns lines into a list — and its line count can lie

By var1ableX·Created 2 years ago·Updated 11 months ago· 1
Make List From Text
    • list
    • lines count
    text

    Make List From Text is a one-trick node: paste a bunch of lines into a multiline box, get a list of strings and a count. If you've ever built a workflow that generates one image per prompt - batch variation, a queue of LoRA names to cycle, a list of filenames - you've either reimplemented this by hand or downloaded a whole pack for a fancier version. This one is fine, with one honest caveat that's baked straight into the source.

    How it works

    It takes your text, calls splitlines() (newlines only - commas, semicolons, tabs are none of its business), then builds a second list of stripped, non-empty lines. And here's the part to know: the list output is the raw splitlines result, while the count is the length of the stripped-and-filtered version. Different lists. If your input has a blank line or trailing whitespace, the count and the contents stop agreeing - the count reports how many non-empty trimmed lines there are, but the list you actually receive still contains that stray empty or spacey entry. Paste "a\n\nb" and you'll get a 3-item list alongside a count of 2.

    Inputs and outputs

    One required input: text (STRING, multiline - the box grows, so paste freely). Two outputs: list (a STRING list) and lines count (an INT). The list is the one you feed into anything that consumes an array of strings - an iterator, a loop construct, a switch that cycles prompts. The count is handy when you want to loop N times or just display "found 12 lines."

    Why you'd reach for it

    Any workflow that is really "one textarea per thing." Ten prompts to try in one run? Paste them in, drive them through a list-cycling or batch mechanism, and the graph runs itself. It slots cleanly into the ecosystem's list-to-batch and batch-switch nodes, which is the usual next stop for its output.

    Where people get burned

    The blank-line inconsistency above is the big one: if you paste text with trailing newlines or empty lines, trust the list, not the count. There's also no deduping - two identical lines stay in the list - and no trimming of the items you actually receive, since the raw lines are what comes out. If you need clean items, feed it text without stray blanks. Worth knowing: this is the one node in the pack where I'd re-check the repo before relying on output semantics, because the shipped code returns raw lines while counting cleaned ones - a mismatch that could plausibly get "fixed" upstream and change behavior.

    Install

    Same tiny pack as the rest. ComfyUI Manager → search "ComfyUI_Accessories" → install, restart, or:

    cd ComfyUI/custom_nodes && git clone https://github.com/var1ableX/ComfyUI_Accessories
    

    No dependencies, no models.

    Common issues

    The pack-wide one: the current GitHub head throws an ImportError because a deleted GetRandomDimensions class is still imported in __init__.py, so none of the pack's nodes load until that's sorted (one-line fix or wait for upstream). Beyond that, this node has no moving parts other than the count/list mismatch. Empty input gives an empty list and a count of 0, which is the sane behavior.

    CategoryAccessories

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (2)

    NameTypeDescription
    listSTRING
    lines countINT