What is the array itemsize function in Python?
Overview
An array is a collection of multiple elements of the same datatype.
The itemsize function is simply used to check for the length in bytes of one array item in the internal representation.
Syntax
array.itemsize
Parameters
The itemsize function does not take in any parameters.
Return value
The itemsize function returns the length in bytes of one array item in the internal representation of the given array.
Code
Run the code below and see how the itemsize function works.
# importing the array moduleimport array as arr# creating an integer data type arrayx = arr.array('i', [1,2,3,4,5,6,7])# using itemsize functionprint(x.itemsize)