Text Lines To List
Your multi-line text, reborn as a Python list literal
- formatted_text
Some nodes in ComfyUI don't want your text as a blob - they want it as a Python list literal, ["item one", "item two"], ready to be parsed or pasted somewhere that expects that shape. Text Lines To List is the one-line converter for exactly that: take a multi-line text block, turn it into a single string formatted as a Python list. It's the smallest node in this pack's "Text Tools" lineup and it knows it - one input, one output, no settings.
It comes from the same pack as Text Line Select, and the two are siblings in spirit: that node splits text into lines for selection, this one splits text into lines and formats them as a list string. If you've already got Text Line Select's text_list output, you don't need this node - but if your input is a raw multi-line string and your downstream node wants ["a", "b", "c"], this is the direct path.
How it works
Nothing mysterious under the hood: it splits the input on newlines, strips whitespace off each line, filters out empty lines, then joins them with double quotes and commas inside square brackets. The formatted_text output looks like:
["epic orchestral", "lo-fi beats", "synthwave night drive"]
Note the deliberate choices: double quotes (not single), and empty lines silently dropped. The author's description says "string formatted as a Python list," and that's literally what you get - a string, not an actual list. ComfyUI has no native list-literal type for text nodes, so the formatting is the whole point.
If the input is empty or all blank lines, it returns [] rather than erroring, so downstream nodes get a valid (empty) list to chew on.
The input and output
- text - your multi-line input (wired in - it's
forceInput). - formatted_text - the Python-list-literal string.
Installing
Text Lines To List ships in the drmbt/comfyui-dreambait-nodes pack. Install the pack via ComfyUI Manager (search comfyui-dreambait-nodes) or:
cd ComfyUI/custom_nodes
git clone https://github.com/drmbt/comfyui-dreambait-nodes
# restart ComfyUI
No dependencies, no models, no config.
Where it fits
Use it wherever a node, script, or API call in your pipeline expects list syntax - some wildcard processors, prompt template nodes, and custom script nodes are picky about this shape, and hand-formatting a dozen prompt variations is exactly the kind of busywork this kills. It also doubles as a tidy data display: wire any multi-line text into it and read the list form in the UI. The honest limitation is that it's a formatter, not a parser - if your downstream needs an actual list object rather than a string, you'll want a node with a real list output (Text Line Select's text_list is the natural pick). For the narrow job it does, it's finished. No drama, no surprises.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| formatted_text | STRING | — |