On this page
  1. struct.calcsize
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

struct.calcsize

Up: struct | Next: struct.error
Rel: struct.error, struct.iter_unpack, struct.pack, struct.pack_into
Ref: docs.python.org — struct.calcsize
Tags: #public #python3 #stdlib #struct


Import

import struct
from struct import calcsize

Signature & Overview

struct.calcsize(format, /)

Return size in bytes of the struct described by the format string.

Usage

import struct

assert struct.calcsize("!IHH") == 8

Gotchas

REPL Inspect

from struct import calcsize
help(calcsize)

Linked from

Related notes