本文簡要介紹 python 語言中 numpy.matrix.tobytes
的用法。
用法:
matrix.tobytes(order='C')
構造包含數組中原始數據字節的 Python 字節。
構造 Python 字節,顯示數據內存的原始內容的副本。默認情況下,字節對象在C-order 中生成。此行為由
order
參數控製。- order: {‘C’, ‘F’, ‘A’},可選
控製字節對象的內存布局。 “C”表示C-order,“F”表示F-order,如果 a 是 Fortran 連續的,“A”(Any 的縮寫)表示“F”,否則表示“C”。默認為“C”。
- s: 字節
展示 a 的原始數據副本的 Python 字節。
參數:
返回:
例子:
>>> x = np.array([[0, 1], [2, 3]], dtype='<u2') >>> x.tobytes() b'\x00\x00\x01\x00\x02\x00\x03\x00' >>> x.tobytes('C') == x.tobytes() True >>> x.tobytes('F') b'\x00\x00\x02\x00\x01\x00\x03\x00'
相關用法
- Python numpy matrix.tolist用法及代碼示例
- Python numpy matrix.tostring用法及代碼示例
- Python numpy matrix.transpose用法及代碼示例
- Python numpy matrix.A1用法及代碼示例
- Python numpy matrix.T用法及代碼示例
- Python numpy matrix.I用法及代碼示例
- Python numpy matrix.partition用法及代碼示例
- Python numpy matrix.itemsize用法及代碼示例
- Python numpy matrix.newbyteorder用法及代碼示例
- Python numpy matrix.sort用法及代碼示例
- Python numpy matrix.std用法及代碼示例
- Python numpy matrix.strides用法及代碼示例
- Python numpy matrix.squeeze用法及代碼示例
- Python numpy matrix.getA1用法及代碼示例
- Python numpy matrix.setfield用法及代碼示例
- Python numpy matrix.resize用法及代碼示例
- Python numpy matrix.size用法及代碼示例
- Python numpy matrix.getfield用法及代碼示例
- Python numpy matrix.A用法及代碼示例
- Python numpy matrix.flat用法及代碼示例
- Python numpy matrix.ctypes用法及代碼示例
- Python numpy matrix.sum用法及代碼示例
- Python numpy matrix.nbytes用法及代碼示例
- Python numpy matrix.itemset用法及代碼示例
- Python numpy matrix.min用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.matrix.tobytes。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。