Memoryview Attributes
memoryview.format
Read the exporter’s element-format string, describing how individual items are represented. For example B denotes an unsigned byte, b a signed byte and c a one-byte bytes value. Some exporters expose more elaborate formats; not every format supports indexing, tolist() or cast(). The format is not a text encoding or a file format. Read-only attribute; use cast() where its constraints permit reinterpretation.
Formal Syntax & Structure
python syntaxpython
view.formatReturn Value
str
Element format string.
Working Example
Example Snippetpython
view = memoryview(b"ABC")print(view.format, view[0])chars = view.cast("c")print(chars.format, chars[0])