{
  "id": "python-struct-table",
  "kind": "table",
  "slug": "python-struct",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-struct/",
  "title": "Python struct: pack and unpack binary data",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "@ (default)",
      "source": "Python docs",
      "detail": "native native size and native alignment"
    },
    {
      "name": "=",
      "source": "Python docs",
      "detail": "native standard size, no alignment"
    },
    {
      "name": "<",
      "source": "Python docs",
      "detail": "little-endian standard size, no alignment"
    },
    {
      "name": ">",
      "source": "Python docs",
      "detail": "big-endian standard size, no alignment"
    },
    {
      "name": "!",
      "source": "Python docs",
      "detail": "network (big-endian) standard size, no alignment"
    },
    {
      "name": "pack()",
      "source": "Python docs",
      "detail": "arguments must match the values required by the format exactly."
    },
    {
      "name": "unpack()",
      "source": "Python docs",
      "detail": "always returns a tuple, even for exactly one item, and the buffer size must match calcsize(fmt)."
    },
    {
      "name": "pack_into()",
      "source": "Python docs",
      "detail": "writes packed bytes into a writable buffer at offset, and unpack_from() reads from an offset; a negative offset counts from the end of buffer."
    },
    {
      "name": "iter_unpack()",
      "source": "Python docs",
      "detail": "yields one tuple per equally sized chunk; the buffer size must be a multiple of the format size."
    }
  ],
  "related_slugs": [
    "python-read-write-files",
    "python-collections-containers"
  ],
  "license": "CC-BY-4.0",
  "source_license": "PSF-2.0 (Python docs); PSF-2.0 (python/cpython (GitHub)); prose restates cited source lines in own words",
  "as_of": "2026-11-18",
  "status": "fill-draft-20261118",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}