Files
efficiency-nodes-comfyui/workflows/python_expresssion_examples.txt
2023-04-06 15:05:52 -05:00

45 lines
1.4 KiB
Plaintext

Here are a few python expression examples one can use in "Evaluate Integers/Strings" nodes.
note: All variables are optional in the expression.
______________________________________________
"EVALUATE INTEGERS" NODE EXPRESSION EXAMPLES:
Add: a + b + c
Subtract: a - b - c
Multiply: a * b * c
Divide: a / b / c
Modulus: a % b % c
Exponentiation: a ** b ** c
Bitwise NOT: ~a, ~b, ~c
Left Shift: a << b << c
Right Shift: a >> b >> c
Greater Than: a > b > c
Less Than: a < b < c
Greater Than or Equal To: a >= b >= c
Less Than or Equal To: a <= b <= c
Equal To: a == b == c
Not Equal To: a != b != c
Absolute Value: abs(a) + abs(b) + abs(c)
Maximum: max(a, b, c)
______________________________________________
"EVALUATE STRINGS" NODE EXPRESSION EXAMPLES:
Concatenate: a + b + c
Repeat: a * len(b) * len(c)
Slice: a[slice(int(b), int(c))]
Find: a.find(b, int(c))
Count: a.count(b, int(c))
Replace: a.replace(b, c)
Uppercase: a.upper() + b.upper() + c.upper()
Lowercase: a.lower() + b.lower() + c.lower()
Capitalize: a.capitalize() + b.capitalize() + c.capitalize()
Title case: a.title() + b.title() + c.title()
Swap case: a.swapcase() + b.swapcase() + c.swapcase()
Strip leading/trailing characters: a.strip(b) + c.strip(b)
Split: a.split(b) + c.split(b)
Join: b.join([a, c])
______________________________________________
If you need help writing python expressions, I suggest using ChatGPT!