📜  Numpy ndarray.tobytes()函数| Python

📅  最后修改于: 2022-05-13 01:54:22.987000             🧑  作者: Mango

Numpy ndarray.tobytes()函数| Python

numpy.ndarray.tobytes()函数构造包含数组中原始数据字节的Python字节。

代码#1:

# Python program explaining
# numpy.ndarray.tobytes() function
  
# importing numpy as geek 
import numpy as geek
  
arr = geek.array([[0, 1], [2, 3]], dtype ='

输出 :

b'\x00\x00\x01\x00\x02\x00\x03\x00'


代码#2:

# Python program explaining
# numpy.ndarray.tobytes() function
  
# importing numpy as geek 
import numpy as geek
  
arr = geek.array([[0, 1], [2, 3]], dtype ='

输出 :

b'\x00\x00\x02\x00\x01\x00\x03\x00'