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.
array.itemsize
The itemsize
function does not take in any parameters.
The itemsize
function returns the length in bytes of one array item in the internal representation of the given array.
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)