Evaluate Strings
Evaluate Strings
- STRING
Evaluate Strings is the text sibling of Evaluate Integers. You write a small Python expression that operates on strings, feed in up to three text inputs, and it hands back the resulting string. In practice it's how you build prompts (or filenames, or captions) by gluing pieces together with logic instead of typing the whole thing out by hand every time.
It's part of the pack's SimpleEval group, all riding on the little simpleeval library that evaluates simple expressions without letting arbitrary code run wild.
How it works
Three optional string inputs - a, b, c - and an expression field. The default expression is a + b + c, which just concatenates them (the defaults "Hello", " World", "!" spell out the idea). Swap in whatever string logic you need: joining, slicing, conditional bits of prompt. The evaluated result comes out as a single string you can wire into a prompt, a Save Image filename, a text display, anywhere text goes.
The point over a plain concat node is the expression: you can do more than stick strings end to end - you get real operations on the text.
The inputs and outputs
python_expression- your string formula, referencinga,b,c.a/b/c- up to three string inputs, all optional, so you can hardcode text in the expression or pull it from elsewhere.print_to_console-True/False; prints the result, useful for seeing exactly what string got built.
The single output is a STRING. Common landing spots: the prompt box of a text-encode node, a filename prefix on Save Image, or a show-text node while you're building the logic.
Installing it
ComfyUI Manager → search Efficiency Nodes for ComfyUI, or:
cd ComfyUI/custom_nodes
git clone https://github.com/jags111/efficiency-nodes-comfyui
Restart after. The eval nodes need the simpleeval library on top of the pack itself - if it's not installed, run pip install simpleeval in ComfyUI's Python environment and restart. The rest of the pack will load without it, but these nodes won't run.
Common issues
If Evaluate Strings is missing while other Efficiency nodes are fine, it's the simpleeval dependency - and the usual trap is installing it into the wrong Python (system Python instead of the venv or the portable build that ComfyUI actually uses). Install it where ComfyUI runs.
Expression mistakes are the other source of failures: a typo, referencing an input you didn't provide, or an operation simpleeval blocks. Flip print_to_console on to see what it's producing. Keep in mind string operations expect strings - if you're mixing in numbers, you may need to convert them within the expression.
Pack-wide: an IMPORT FAILED on startup (often citing a pip freeze error) means the pack didn't load at all - update ComfyUI, your packages, and the node before digging further.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| python_expression | STRING | a + b + c | — |
| print_to_console | COMBO | 2 options: False, True | |
| aopt | STRING | Hello | — |
| bopt | STRING | World | — |
| copt | STRING | ! | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |