Extensions/Basic data handling
ComfyUI Extension

Basic data handling

Basic Python functions for manipulating data that every programmer is used to. Currently supported: BOOLEAN, FLOAT, INT, STRING and data lists.

By StableLlama·Created about a year ago·Updated 19 days ago· 45
StableLlama/ComfyUI-basic_data_handling
Nodes309
On cloudLocal install
CategoryBasic/BOOLEAN, Basic/cast
Stars45
Updated19 days ago

Nodes (309)

and
Basic/BOOLEAN
nand
Basic/BOOLEAN
nor
Basic/BOOLEAN
not
Basic/BOOLEAN
or
Basic/BOOLEAN
xor
Basic/BOOLEAN
to BOOLEAN
Basic/cast
to DICT
Basic/cast
to FLOAT
Basic/cast
to INT
Basic/cast
to LIST
Basic/cast
to SET
Basic/cast
to STRING
Basic/cast
compare length
Basic/comparison
continue flow
Basic/flow control
all
Basic/Data List
any
Basic/Data List
append
Basic/Data List
contains
Basic/Data List
count
Basic/Data List
create Data List
Basic/Data List
create Data List from BOOLEANs
Basic/Data List
create Data List from FLOATs
Basic/Data List
create Data List from INTs
Basic/Data List
create Data List from STRINGs
Basic/Data List
enumerate
Basic/Data List
extend
Basic/Data List
filter
Basic/Data List
filter select
Basic/Data List
first
Basic/Data List
get item
Basic/Data List
index
Basic/Data List
insert
Basic/Data List
last
Basic/Data List
length
Basic/Data List
create Data List of Lists
Basic/Data List
max
Basic/Data List
min
Basic/Data List
pop
Basic/Data List
pop random
Basic/Data List
range
Basic/Data List
remove
Basic/Data List
reverse
Basic/Data List
set item
Basic/Data List
shuffle
Basic/Data List
slice
Basic/Data List
sort
Basic/Data List
sum
Basic/Data List
convert to LIST
Basic/Data List
convert to SET
Basic/Data List
zip
Basic/Data List
compare
Basic/DICT
contains key
Basic/DICT
create DICT
Basic/DICT
create DICT from BOOLEANs
Basic/DICT
create DICT from FLOATs
Basic/DICT
create DICT from INTs
Basic/DICT
create from items (data list)
Basic/DICT
create from items (LIST)
Basic/DICT
create from LISTs
Basic/DICT
create DICT from STRINGs
Basic/DICT
exclude keys
Basic/DICT
filter by keys
Basic/DICT
from keys
Basic/DICT
get
Basic/DICT
get keys values
Basic/DICT
get multiple
Basic/DICT
invert
Basic/DICT
items
Basic/DICT
keys
Basic/DICT
length
Basic/DICT
merge
Basic/DICT
pop
Basic/DICT
pop item
Basic/DICT
pop random
Basic/DICT
remove
Basic/DICT
set
Basic/DICT
setdefault
Basic/DICT
update
Basic/DICT
values
Basic/DICT
==
Basic/comparison
force execution order
Basic/flow control
add
Basic/FLOAT
integer ratio
Basic/FLOAT
create FLOAT
Basic/FLOAT
divide
Basic/FLOAT
divide (zero safe)
Basic/FLOAT
from hex
Basic/FLOAT
to hex
Basic/FLOAT
is integer
Basic/FLOAT
multiply
Basic/FLOAT
power
Basic/FLOAT
round
Basic/FLOAT
subtract
Basic/FLOAT
flow select
Basic/flow control
force calculation
Basic/flow control
and (generic)
Basic/BOOLEAN
or (generic)
Basic/BOOLEAN
>
Basic/comparison
>=
Basic/comparison
if/elif/.../else
Basic/flow control
if/else
Basic/flow control
add
Basic/INT
bit count
Basic/INT
bit length
Basic/INT
create INT
Basic/INT
create INT with base
Basic/INT
divide
Basic/INT
divide (zero safe)
Basic/INT
from bytes
Basic/INT
modulus
Basic/INT
multiply
Basic/INT
power
Basic/INT
subtract
Basic/INT
to bytes
Basic/INT
is connected
Basic/flow control
is null
Basic/comparison
<
Basic/comparison
<=
Basic/comparison
all
Basic/LIST
any
Basic/LIST
append
Basic/LIST
contains
Basic/LIST
count
Basic/LIST
create LIST
Basic/LIST
create LIST from BOOLEANs
Basic/LIST
create LIST from FLOATs
Basic/LIST
create LIST from INTs
Basic/LIST
create LIST from STRINGs
Basic/LIST
enumerate
Basic/LIST
extend
Basic/LIST
first
Basic/LIST
get item
Basic/LIST
index
Basic/LIST
insert
Basic/LIST
last
Basic/LIST
length
Basic/LIST
max
Basic/LIST
min
Basic/LIST
pop
Basic/LIST
pop random
Basic/LIST
range
Basic/LIST
remove
Basic/LIST
reverse
Basic/LIST
set item
Basic/LIST
shuffle
Basic/LIST
slice
Basic/LIST
sort
Basic/LIST
sum
Basic/LIST
convert to Data List
Basic/LIST
convert to SET
Basic/LIST
abs
Basic/maths
acos
Basic/maths
asin
Basic/maths
atan
Basic/maths
atan2
Basic/maths
ceil
Basic/maths
cos
Basic/maths
degrees
Basic/maths
e (2.71828)
Basic/maths
exp
Basic/maths
floor
Basic/maths
formula
Basic/maths
log
Basic/maths
log10
Basic/maths
max
Basic/maths
min
Basic/maths
pi (3.14159)
Basic/maths
radians
Basic/maths
sin
Basic/maths
sqrt
Basic/maths
tan
Basic/maths
!=
Basic/comparison
in range
Basic/comparison
abspath
Basic/Path
basename
Basic/Path
common prefix
Basic/Path
dirname
Basic/Path
exists
Basic/Path
expand vars
Basic/Path
get current working directory
Basic/Path
get extension
Basic/Path
get size
Basic/Path
glob
Basic/Path
input dir
Basic/Path
is absolute
Basic/Path
is dir
Basic/Path
is file
Basic/Path
join
Basic/Path
list dir
Basic/Path
load IMAGE from file (RGB)
Basic/Path
load IMAGE+MASK from file (RGBA)
Basic/Path
load MASK from alpha channel
Basic/Path
load MASK from greyscale/red
Basic/Path
load STRING from file
Basic/Path
normalize
Basic/Path
output dir
Basic/Path
relative
Basic/Path
save IMAGE to file
Basic/Path
save IMAGE+MASK to file
Basic/Path
save STRING to file
Basic/Path
set extension
Basic/Path
split
Basic/Path
splitext
Basic/Path
find all (data list)
Basic/STRING/regex
find all (LIST)
Basic/STRING/regex
search named groups
Basic/STRING/regex
search groups (data list)
Basic/STRING/regex
search groups (LIST)
Basic/STRING/regex
split (data list)
Basic/STRING/regex
split (LIST)
Basic/STRING/regex
substitute
Basic/STRING/regex
test
Basic/STRING/regex
add
Basic/SET
all
Basic/SET
any
Basic/SET
contains
Basic/SET
create SET
Basic/SET
create SET from BOOLEANs
Basic/SET
create SET from FLOATs
Basic/SET
create SET from INTs
Basic/SET
create SET from STRINGs
Basic/SET
difference
Basic/SET
discard
Basic/SET
enumerate
Basic/SET
intersection
Basic/SET
is disjoint
Basic/SET
is subset
Basic/SET
is superset
Basic/SET
length
Basic/SET
pop
Basic/SET
pop random
Basic/SET
remove
Basic/SET
sum
Basic/SET
symmetric difference
Basic/SET
convert to Data List
Basic/SET
convert to LIST
Basic/SET
union
Basic/SET
capitalize
Basic/STRING
casefold
Basic/STRING
center
Basic/STRING
string compare
Basic/comparison
concat
Basic/STRING
count
Basic/STRING
join (from data list)
Basic/STRING
decode
Basic/STRING
encode
Basic/STRING
endswith
Basic/STRING
escape
Basic/STRING
expandtabs
Basic/STRING
find
Basic/STRING
format_map
Basic/STRING
in (contains)
Basic/STRING
isalnum
Basic/STRING/is
isalpha
Basic/STRING/is
isascii
Basic/STRING/is
isdecimal
Basic/STRING/is
isdigit
Basic/STRING/is
isidentifier
Basic/STRING/is
islower
Basic/STRING/is
isnumeric
Basic/STRING/is
isprintable
Basic/STRING/is
isspace
Basic/STRING/is
istitle
Basic/STRING/is
isupper
Basic/STRING/is
length
Basic/STRING
join (from LIST)
Basic/STRING
ljust
Basic/STRING
lower
Basic/STRING
lstrip
Basic/STRING
removeprefix
Basic/STRING
removesuffix
Basic/STRING
replace
Basic/STRING
rfind
Basic/STRING
rjust
Basic/STRING
rsplit (from data list)
Basic/STRING
rsplit (from LIST)
Basic/STRING
rstrip
Basic/STRING
split (to data list)
Basic/STRING
splitlines (from data list)
Basic/STRING
splitlines (to LIST)
Basic/STRING
split (to LIST)
Basic/STRING
startswith
Basic/STRING
strip
Basic/STRING
swapcase
Basic/STRING
title
Basic/STRING
unescape
Basic/STRING
upper
Basic/STRING
zfill
Basic/STRING
switch/case
Basic/flow control
Add Time Delta
Basic/time
Create Time Delta
Basic/time
Time Difference
Basic/time
Extract Time Components
Basic/time
Format Time String
Basic/time
Time Now
Basic/time
Time Now (UTC)
Basic/time
Parse Time String
Basic/time
Subtract Time Delta
Basic/time
Time to Unix Timestamp
Basic/time
Unix Timestamp to Time
Basic/time
Tensor Binary Op
Basic/tensor
Tensor Create
Basic/tensor
Tensor Info
Basic/tensor
Tensor Join
Basic/tensor
Tensor Permute
Basic/tensor
Tensor Reshape
Basic/tensor
Tensor Slice
Basic/tensor
Tensor Unary Op
Basic/tensor
Readme

Basic Data Handling

Basic Python functions for manipulating data that every programmer is used to. These nodes are very lightweight and require no additional dependencies.

Quickstart

Recommended Installation

  1. Install ComfyUI
  2. Install ComfyUI-Manager
  3. Look up the "Basic data handling" extension in ComfyUI-Manager
  4. Restart ComfyUI

Alternative (Manual Installation)

  1. Install ComfyUI
  2. Clone this repository under ComfyUI/custom_nodes
  3. Restart ComfyUI

Node Categories

BOOLEAN

Boolean logic operations:

  • Logic operations: and, or, not, xor, nand, nor

Cast

Type conversion nodes for ComfyUI data types: to BOOLEAN, to FLOAT, to INT, to STRING, to DICT, to LIST, to SET

Comparison

Value comparison nodes:

  • Basic comparisons: equal (==), not equal (!=), greater than (>), greater than or equal (>=), less than (<), less than or equal (<=)
  • String comparison: StringComparison with case-sensitive/insensitive options
  • Special comparisons: NumberInRange, IsNull
  • Container operations: CompareLength

Control Flow

Mechanisms to direct workflow execution:

  • Conditional branching:
    • if/else - Routes based on a boolean condition
    • if/elif/.../else - Supports multiple conditional branches
    • switch/case - Selects from options based on an index
  • Execution management:
    • disable flow - Conditionally enables/disables a flow
    • flow select - Directs output to either "true" or "false" path
    • force calculation - Prevents caching and forces recalculation
    • force execution order - Controls node execution sequence

Data List

ComfyUI list manipulation nodes (for processing individual items):

  • Creation: create Data List (generic and type-specific versions)
  • Modification: append, extend, insert, set item, shuffle, remove, pop, pop random
  • Filtering: filter, filter select
  • Access: get item, first, last, slice, index, contains
  • Information: length, count
  • Operations: sort, reverse, zip, min, max
  • Conversion: convert to LIST, convert to SET

DICT

Dictionary manipulation nodes:

  • Creation: create (generic and type-specific), create from items, create from lists, fromkeys
  • Access: get, get_multiple, keys, values, items
  • Modification: set, update, setdefault, merge
  • Removal: pop, popitem, pop random, remove
  • Information: length, contains_key
  • Operations: filter_by_keys, exclude_keys, invert, compare
  • Conversion: get_keys_values

FLOAT

Floating-point operation nodes:

  • Creation: create FLOAT from string
  • Basic arithmetic: add, subtract, multiply, divide, divide (zero safe), power
  • Formatting: round (to specified decimal places)
  • Conversion: to_hex, from_hex
  • Analysis: is_integer, as_integer_ratio

INT

Integer operation nodes:

  • Creation: create INT, create INT with base
  • Basic arithmetic: add, subtract, multiply, divide, divide (zero safe), modulus, power
  • Bit operations: bit_length, bit_count
  • Byte conversion: to_bytes, from_bytes

LIST

Python list manipulation nodes (as a single variable):

  • Creation: create LIST (generic and type-specific versions)
  • Modification: append, extend, insert, remove, pop, pop random, set_item, shuffle
  • Access: get_item, first, last, slice, index, contains
  • Information: length, count
  • Operations: sort, reverse, min, max
  • Conversion: convert to data list, convert to SET

Math

Mathematical operations:

  • Generic: formula
  • Trigonometric functions: sin, cos, tan, asin, acos, atan, atan2
  • Logarithmic/Exponential: log, log10, exp, sqrt
  • Constants: pi, e
  • Angle conversion: degrees, radians
  • Rounding operations: floor, ceil
  • Min/Max functions: min, max
  • Other: abs

Path

File system path manipulation nodes:

  • Basic operations: join, split, splitext, basename, dirname, normalize
  • Path information: abspath, exists, is_file, is_dir, is_absolute, get_size, get_extension, set_extension, input_dir, output_dir
  • Directory operations: list_dir, get_cwd
  • Path searching: glob, common_prefix
  • Path conversions: relative, expand_vars
  • File loading: load STRING from file, load IMAGE from file, load IMAGE+MASK from file, load MASK from alpha channel, load MASK from greyscale/red
  • File saving: save STRING to file, save IMAGE to file, save IMAGE+MASK to file

SET

Python set manipulation nodes (as a single variable):

  • Creation: create SET (generic and type-specific versions)
  • Modification: add, remove, discard, pop, pop random
  • Information: length, contains
  • Set operations: union, intersection, difference, symmetric_difference
  • Set comparison: is_subset, is_superset, is_disjoint
  • Conversion: convert to data list, convert to LIST

STRING

String manipulation nodes:

  • Text case conversion: capitalize, casefold, lower, swapcase, title, upper
  • Text inspection: contains, endswith, find, length, rfind, startswith
  • Character type checking: isalnum, isalpha, isascii, isdecimal, isdigit, isidentifier, islower, isnumeric, isprintable, isspace, istitle, isupper
  • Text formatting: center, expandtabs, ljust, rjust, zfill
  • Text splitting/joining: join, split, rsplit, splitlines (with data list and LIST variants)
  • Text modification: concat, count, replace, strip, lstrip, rstrip, removeprefix, removesuffix
  • Encoding/escaping: decode, encode, escape, unescape, format_map

TENSOR

PyTorch tensor manipulation nodes:

  • Creation: Tensor Create (from numbers, lists, or other tensors)
  • Arithmetic: Tensor Binary Op (add, subtract, multiply, divide, power, remainder, floor_divide)
  • Functions: Tensor Unary Op (abs, neg, exp, log, sin, cos, sqrt, sigmoid, relu)
  • Reshaping: Tensor Reshape, Tensor Permute (dims)
  • Access: Tensor Slice (supports Python-style slice strings like 0:10, :, 5)
  • Combined: Tensor Join (concatenate or stack)
  • Analysis: Tensor Info (returns shape, dtype, device)

Time

Date and time manipulation nodes:

  • DateTime creation/conversion: TimeNow, TimeNowUTC, TimeToUnix, UnixToTime
  • String formatting/parsing: TimeFormat, TimeParse
  • Time calculations: TimeDelta, TimeAddDelta, TimeSubtractDelta, TimeDifference
  • Component extraction: TimeExtract (year, month, day, hour, etc.)

Understanding Data Types

ComfyUI provides three different collection types that serve distinct purposes:

Collection Types and When to Choose Them

| Type | Description | When to Choose | |---------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | data list | Native ComfyUI list where items are processed individually | • When you need ComfyUI to process each item individually<br>• For batch operations with parallel processing<br>• When connecting to nodes that expect individual inputs | | LIST | Python list passed as a single variable | • When you need ordered collections with preserved duplicates<br>• When index-based access is important<br>• When you need to work with the collection as a complete unit | | SET | Python set passed as a single variable | • When you need to ensure unique values only<br>• When you need fast membership testing<br>• For set operations (union, intersection, etc.)<br>• When element order doesn't matter |