简体   繁体   中英

Write a data variable to binary file in python

In Matlab/Octave we have this command to save a variable to binary file:

a = fwrite(myfile, uint16(x), "uint16");

I would like to know is there any equivalent command in Python?

Thank you

I think it could be a solution

import numpy as np

a = myfile.write(np.uint16(x));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM