numpy.ndarray.nbytes()函數返回數組元素消耗的總字節數。
用法: numpy.ndarray.nbytes(arr)
參數:
arr :[數組]輸入數組。
Return :[int]數組元素消耗的總字節數。
代碼1:
# Python program explaining
# numpy.ndarray.nbytes() function
# importing numpy as geek
import numpy as geek
arr = geek.zeros((1, 2, 3), dtype = geek.complex128)
gfg = arr.nbytes
print (gfg)
輸出:
96
代碼2:
# Python program explaining
# numpy.ndarray.nbytes() function
# importing numpy as geek
import numpy as geek
arr = geek.random.rand(10000, 50)
gfg = arr.nbytes
print (gfg)
輸出:
4000000
相關用法
- Python set()用法及代碼示例
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python PyTorch div()用法及代碼示例
- Python PIL getpalette()用法及代碼示例
- Python Pytorch eye()用法及代碼示例
- Python os.chdir()用法及代碼示例
- Python Numpy np.fft()用法及代碼示例
- Python isinstance()用法及代碼示例
- Python PIL putdata()用法及代碼示例
- Python numpy.ma.ids()用法及代碼示例
- Python os.utime()用法及代碼示例
- Python os.kill()用法及代碼示例
- Python PIL GaussianBlur()用法及代碼示例
- Python PIL getcolors()用法及代碼示例
- Python os.WIFSTOPPED()用法及代碼示例
- Python os.WIFCONTINUED()用法及代碼示例
注:本文由純淨天空篩選整理自sanjoy_62大神的英文原創作品 numpy.ndarray.nbytes() method | Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。