Format Text
Format Text
- values
- STRING
Format Text is exactly what the pack's own description says it is: Python's .format() method, as a ComfyUI node. You write a template string with {name}-style placeholders, feed it a set of named values, and it stitches them together into one output string. If you've ever written f"{subject}, {style}, lit by {lighting}" in Python, you already know how to use this node.
Why you'd reach for it
This is the assembly node for the rest of the Variables for Comfy UI pack. The String, Int, Float, and Short String nodes each declare one named value; Format Text is where you pull several of them together into a single piece of text. Think prompt templating: keep a fixed structure like "{subject}, {medium}, {lighting}, highly detailed" and swap only the named values feeding it between runs, instead of rewriting the whole prompt by hand each time. It's also just a handy general-purpose string builder any time you need to combine several dynamic values into one line - a filename, a caption, a debug label - without daisy-chaining a pile of concatenation nodes.
How it works
Two inputs do the real work. f_string is your template - plain text with {name} placeholders anywhere you want a value substituted, using the same syntax as Python's str.format(). values is where you supply what fills those placeholders: it's an auto-growing input, so you add as many named slots as your template needs, one per placeholder, and name each slot to match. Feed it the STRING/INT/FLOAT outputs of the pack's variable nodes, or wire in values from anywhere else in your graph - it doesn't care where a value comes from as long as the name lines up with what's in your template.
Because it's genuinely Python's .format() under the hood, you get all of that method's features for free - number formatting specs like {price:.2f}, padding, alignment, the works - if you know Python string formatting, none of it is off-limits here.
Inputs and outputs
- values - an auto-growing set of named inputs. Add one per placeholder in your template; the name of each slot is what you reference inside
{}. - f_string - the template itself, multiline, defaulting to
{a}. Every{name}in here needs a matching entry invalues.
Output: a single STRING - the assembled result, ready to wire into a CLIP Text Encode (With Variables) node, a save-file name, or anywhere else that takes text.
Installing it
Through ComfyUI Manager, search "Variables for Comfy UI." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yolanother/DTAIComfyVariables
Restart ComfyUI. Per the README, ComfyUI is the only dependency - nothing to pip install, no models to fetch.
Common issues
Placeholder name doesn't match a values slot. This is a hard error in Python's .format(), and it carries over here - a {name} in your template with no corresponding entry in values will fail the node rather than silently leaving the placeholder in place. Add a slot for every name you reference.
Unrelated curly braces in your text. If your template text happens to contain a literal { or } that isn't meant as a placeholder, Python's format syntax will try to parse it as one and error out. Escape literal braces by doubling them ({{ and }}), same as you would in Python.
Confusing this with Short String Format. The pack ships a second formatting node with a different, incompatible placeholder syntax ($(name) instead of {name}). They're not interchangeable - using the wrong syntax in the wrong node means your placeholder just prints literally instead of getting replaced.
Thin community support. Small, single-maintainer pack - if you hit an edge case in the formatting behavior, Python's own str.format() documentation is often a faster reference than searching for someone else's report of the same issue.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| values | COMFY_AUTOGROW_V3 | — | |
| f_string | STRING | {a} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |