Created
October 12, 2019 15:14
-
-
Save pedramamini/d2cf9006e05440c517f7b1b388c7f8dd 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
import sys | |
if len(sys.argv) != 2: | |
sys.stderr.write("usage: %s <input path>\n" % sys.argv[0]) | |
sys.exit(1) | |
path = sys.argv.pop() | |
data1 = [] | |
data2 = [] | |
data3 = [] | |
with open(path) as fh: | |
for line in fh.readlines()[1:]: | |
col1, col2, col3 = map(int, line.split(",")) | |
data1.append(chr(col1^201)) | |
data2.append(chr(col2^201)) | |
data3.append(chr(col3^201)) | |
with open(path + ".data1", "wb+") as fh: | |
sys.stdout.write("writing %d bytes to %s\n" % (len(data1), path + ".data1")) | |
for b in data1: | |
fh.write(b) | |
with open(path + ".data2", "wb+") as fh: | |
sys.stdout.write("writing %d bytes to %s\n" % (len(data2), path + ".data2")) | |
for b in data2: | |
fh.write(b) | |
with open(path + ".data3", "wb+") as fh: | |
sys.stdout.write("writing %d bytes to %s\n" % (len(data3), path + ".data3")) | |
for b in data3: | |
fh.write(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment