Reputation: 127
I am reading file in standard way in python. I mean like this :
with open("path_to_my_file", "rb") as fh:
chunk = fh.read(5120)
But when I read file for example 22000byte size it gives me 5 chunks
1 - 5120
2 - 5120
3 - 5120
4 - 5120
5 - 1520
There is an option to fill up to full last chunk by Nulls on 1521-5120 indexes ??
Upvotes: 1
Views: 70
Reputation: 527
I thing the simplest way is to do something like this :
padded_chunk = ( chunk + '\0'*5120 ) [:5120]
Now padded_chunk
is end-padded with nulls.
Upvotes: 1