Nodes/WAS Node Suite v3/Text List to Numbers
ComfyUI Node Runs on cloud

Text List to Numbers

Read a list as numbers and let the graph fan out

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Text List to Numbers
  • text_list
  • NUMBER
  • floats
  • ints
  • count
unreadable
round_to_intfalse

Somewhere in a real workflow you end up with numbers stuck inside text - a CSV column of seed values, a schedule typed as "1, 2, 4, 8", a file of step counts. Text List to Numbers is the node that lifts them out onto the numeric sockets where the math and loop nodes actually live, and it fans the graph out once per value as it goes.

What it does

Drop a list into text_list - entries can already be numbers or text holding a number - and it parses each one, then hands the values out three ways:

  • NUMBER - one per value, for the pack's arithmetic and counter nodes.
  • floats - the same values as FLOAT, one per run.
  • ints - the values as INT, one per run, ready for a step count or a seed.

All three are list outputs, which is the suite's big idea: any node reading them executes once per value. Six numbers in means the graph below runs six times, each with a different number on the wire. That's how a file of seed values becomes six renders, or a text schedule becomes six differently-sized steps.

Parsing is forgiving but honest: surrounding space, a leading + or - and a decimal point are all read, so ' -1.5 ' arrives as -1.5. An entry that reads as nan or infinity takes the same route as one that isn't a number at all - which is governed by the unreadable setting:

  • skip - leaves it out (right for a column with a heading on its first line).
  • zero - keeps the position and puts a 0 there (right for a schedule where entry 7 has to stay entry 7).
  • error - stops the prompt and names the entry it choked on.

The one other knob, round_to_int, decides whether the INT socket rounds 1.9 to 2 or cuts it to 1. Off (default) truncates; on rounds. The NUMBER and FLOAT outputs keep the decimal either way, so this only affects the INT fan-out.

The empty trap

If nothing in the list reads as a number, the prompt stops - because a graph below an empty list cannot be run zero times. That's not a bug, it's the same rule every fan-out list node in this pack follows, and it's why zero exists: set unreadable to zero and every position keeps a value, so the graph always runs. If a genuinely empty result is a possibility in your pipeline, decide in advance whether you want a loud stop or a padded run.

You'll also get a plain count output telling you how many values came through - which is, conveniently, how many times the graph below runs.

Installing it

Part of WAS Node Suite v3 (WASasquatch's was-node-suite-comfyui, MIT). Search "WAS Node Suite v3" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

Restart ComfyUI after installing. Requires ComfyUI 0.14.0+ and Python 3.10+; nothing extra to install.

CategoryWAS Suite/Text/List

Inputs (3)

NameTypeDefaultDescription
text_listARRAYThe list to read. Entries may be numbers already or text holding one; surrounding space, a leading + or - and a decimal point are all read, so ' -1.5 ' arrives as -1.5.
unreadableCOMBOWhat an entry that is not a number does. `skip` leaves it out, `zero` keeps the position and puts 0 there, and `error` stops the prompt.
round_to_intBOOLEANfalseWhether the INT socket rounds to the nearest whole number instead of cutting the decimal off. Off, 1.9 arrives as 1; on, it arrives as 2. The NUMBER and FLOAT sockets keep the decimal either way.

Outputs (4)

NameTypeDescription
NUMBERNUMBEROne NUMBER per entry, for the maths and counter nodes. A node reading this runs once per value. If nothing in the list reads as a number the prompt stops, because a graph cannot be run zero times, set unreadable to `zero` to keep a value in every position.
floatsFLOATThe same values as decimals, one per run.
intsINTThe same values as whole numbers, one per run, for a step count or a seed.
countINTHow many values came through, which is how many times the graph below this node runs.