Created
July 29, 2017 03:26
-
-
Save RASBORA/6e72d15b9ac841f18e071b1b83b1a0bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('modtext.txt','rb') as rp: | |
with open('make.bin','wb') as wp: | |
sumlen=0 | |
head=sumlen.to_bytes(4,'little') | |
body=b'' | |
for line in rp: | |
sumlen += len(line) | |
head += sumlen.to_bytes(4,'little') | |
body+=line[:-1] + b'\0' | |
wp.write(head) | |
wp.write(body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment