Nodes/ComfyUI-Data-Analysis/Py Kv String Create
ComfyUI Node

Py Kv String Create

Stuff a Text Value Into a Dict — Multiline Welcome

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Py Kv String Create
    • PYDICT
    key
    value

    Of the three Py Kv create nodes, this is the one that surprises people: a dict whose value is text. Py Kv String Create takes a string key and a string value - the value field is multiline, so long text is fine - and hands you back a PYDICT.

    Why would a DataFrame-oriented pack care about text dicts? Because dicts here aren't just for tables. They feed dict-consuming nodes, get carried around workflows as small structured payloads, and occasionally become DataFrame columns that hold strings. When a value is genuinely text, this is the correct node - the int and float variants would just break or lie.

    How it works

    It returns {key: value} with both sides as strings. The value input is multiline: true, so it behaves like a text-area widget rather than a single-line field - paste a paragraph, a JSON blob, a multiline label, whatever. The key input stays single-line. Output is a PYDICT, the pack's standard dict type.

    There's no parsing, no evaluation, no encoding tricks: whatever text you typed is the value, byte for byte. That's actually a feature - unlike Py String To Dict, you can't accidentally break it with bad syntax, because nothing is being parsed.

    Inputs and outputs

    • key - the dictionary key, single-line string.
    • value - the value, multiline string.

    Output: one PYDICT.

    Install

    Ships in HowToSD/ComfyUI-Data-Analysis. Manager: search "Data analysis" in the Custom Node Manager, install ComfyUI-Data-Analysis, restart, reload the browser. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
    mv ComfyUI-Data-Analysis data-analysis   # README: example workflows expect this folder name
    pip install -r requirements.txt
    

    No models, no GPU. It's a dict literal with a nicer wrapper.

    Common issues

    The one thing to watch: if your downstream consumer expects a dict of numbers and you give it strings, pandas will treat them as object columns and arithmetic will fail or behave oddly. And there's no type coercion - "12" stays the string "12", so convert with Py String To Int/Float if the consumer needs a number. One entry per node, as with its siblings; combine several via a multi-dict consumer or hand-type with Py String To Dict for bigger payloads.

    CategoryData Analysis

    Inputs (2)

    NameTypeDefaultDescription
    keySTRING
    valueSTRING

    Outputs (1)

    NameTypeDescription
    PYDICTPYDICT