Python – What is the most efficient way to generate padding?
Python – What is the most efficient way to generate padding? Question: Here’s the problem: I’m reading binary files in fairly large blocks (512 KiB) and wish to pad the last block with zeros whenever it is shorter than the block size. Currently, I’m doing something like this: bytes = f.read(self.chunksize) if len(bytes) > 0: …