String Format (Yogurt Nodes)
Python's f-string, minus the f, for prompts that build themselves
- input0
- input1
- input2
- input3
- input4
- input5
- input6
- input7
- input8
- input9
- input10
- input11
- input12
- input13
- input14
- input15
- input16
- input17
- input18
- input19
- input20
- input21
- input22
- input23
- input24
- input25
- input26
- input27
- input28
- input29
- input30
- input31
- formatted
ComfyUI gives you raw values - image widths, seeds, batch sizes, whatever a node happens to emit - but prompts want them inside a sentence. String Format (Yogurt Nodes) is the node that shoves those values into a template. It's Python's str.format() exposed as a graph node: write a template with {input0}, {input1} placeholders, wire in up to 32 values, and get a single formatted string out the other end.
You'll reach for it the moment you want a workflow that adapts. Same graph, different image: feed the width and height from a Get Image Size node into {input0} and {input1}, and your prompt line becomes "a wide shot, 1024px by 1024px" without you retyping anything. Or build a filename, a caption, a metadata string, a negative prompt assembled from toggles. It's glue, and glue is what turns a one-shot workflow into something reusable.
How it works
The mechanism is genuinely just Python's str.format(). The format field holds your template with named placeholders, and each input0 through input31 input becomes a keyword argument named input0 through input31. So the placeholder must match the input you wired - {input0} pulls from the input0 socket, {input7} from the input7 socket, and so on. Because it's str.format and not an f-string, the values are injected as-is at runtime, which is exactly what you want from a graph: change any input and the string rebuilds on the next run.
The inputs that matter
format- the template. This is the one you'll spend your time on. It's multiline, so whole prompt blocks work.input0…input31- the values. Every socket accepts anything (*type), so ints, floats, strings, and JSON all get stringified into the output. Leave unwired ones empty.
One output: formatted - the completed string, ready to feed into a CLIP Text Encode, a filename builder, or another string node.
Installing it
String Format rides along in ComfyUI-YogurtNodes, yogurt7771's big multi-purpose pack. ComfyUI Manager is easiest - search "ComfyUI-YogurtNodes" - or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart ComfyUI and it shows up under "Yogurt Nodes". No downloads, nothing heavy.
Where people get burned
Two classic trips. First, literal braces: because it's str.format, a brace you actually want in the output has to be doubled - {{ and }}. Second, the placeholders are {input0}, not {0} - a lot of people coming from Python habits reach for positional placeholders and get a KeyError instead. If a number comes out ugly (a float printing as 1.0), remember str.format supports format specs, so {input1:.2f} works fine. Beyond that it's about as trouble-free as a string node gets.
Inputs (33)
| Name | Type | Default | Description |
|---|---|---|---|
| format | STRING | — | |
| input0opt | * | The input to be formatted. 0 | |
| input1opt | * | The input to be formatted. 1 | |
| input2opt | * | The input to be formatted. 2 | |
| input3opt | * | The input to be formatted. 3 | |
| input4opt | * | The input to be formatted. 4 | |
| input5opt | * | The input to be formatted. 5 | |
| input6opt | * | The input to be formatted. 6 | |
| input7opt | * | The input to be formatted. 7 | |
| input8opt | * | The input to be formatted. 8 | |
| input9opt | * | The input to be formatted. 9 | |
| input10opt | * | The input to be formatted. 10 | |
| input11opt | * | The input to be formatted. 11 | |
| input12opt | * | The input to be formatted. 12 | |
| input13opt | * | The input to be formatted. 13 | |
| input14opt | * | The input to be formatted. 14 | |
| input15opt | * | The input to be formatted. 15 | |
| input16opt | * | The input to be formatted. 16 | |
| input17opt | * | The input to be formatted. 17 | |
| input18opt | * | The input to be formatted. 18 | |
| input19opt | * | The input to be formatted. 19 | |
| input20opt | * | The input to be formatted. 20 | |
| input21opt | * | The input to be formatted. 21 | |
| input22opt | * | The input to be formatted. 22 | |
| input23opt | * | The input to be formatted. 23 | |
| input24opt | * | The input to be formatted. 24 | |
| input25opt | * | The input to be formatted. 25 | |
| input26opt | * | The input to be formatted. 26 | |
| input27opt | * | The input to be formatted. 27 | |
| input28opt | * | The input to be formatted. 28 | |
| input29opt | * | The input to be formatted. 29 | |
| input30opt | * | The input to be formatted. 30 | |
| input31opt | * | The input to be formatted. 31 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| formatted | STRING | — |