python - convert large binary file to hexadecimal (binascii.hexlify returns MemoryError) -
i trying convert large file (~1gb) hexadecimal string binascii (which works great on smaller files), causing memoryerror.
this code using:
import binascii filepath = "demo/11.mp4.zip" file = open(filepath, "rb") file: byte = file.read() hexa = binascii.hexlify(byte) hexa_string = hexa.decode('ascii');
any advice?
actually approximately using 3 gb of memory storing file , hex within byte
, hexa
variables, instead of can iterate within file , process based on chunks .
Comments
Post a Comment