Python: Get an array buffer information
19. Get Array Buffer Information
Write a Python program to get array buffer information.
Sample Solution:
Python Code:
from array import array
a = array("I", (12,25))
print("Array buffer start address in memory and number of elements.")
print(a.buffer_info())
Sample Output:
Array buffer start address in memory and number of elements. (140023105054240, 2)
For more Practice: Solve these Related Problems:
- Write a Python program to use the buffer_info() method on an array and print its memory address and number of elements.
- Write a Python program to calculate the total size in bytes of an array’s buffer by multiplying its itemsize with its length.
- Write a Python program to compare the buffer_info() output of two different arrays of the same type.
- Write a Python program to implement a function that returns a tuple containing the memory address and size in bytes of an array.
Python Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a Python program to get the array size of types unsigned integer and float.
Next: Write a Python program to get the length of an array.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics