diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-19 16:14:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-19 16:14:23 -0700 |
commit | 45bf4d99ac9d55b182c0aabbf9f2ae73f2c5a3f4 (patch) | |
tree | 87256e8adaa92664058e01784f2097523f2898cc /tools/file2json.py | |
parent | 687ca01ddef89fc405b8422eb69ca453d8ece2c6 (diff) |
file2json stuff
Diffstat (limited to 'tools/file2json.py')
-rw-r--r-- | tools/file2json.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/file2json.py b/tools/file2json.py index a1c37244..f26f2864 100644 --- a/tools/file2json.py +++ b/tools/file2json.py @@ -28,3 +28,22 @@ if len(sys.argv) < 3: else: print 'var ' + sys.argv[2] + '=' + json + ';' +''' +or (but this fails, we get a string at runtime?) + +data = open(sys.argv[1], 'r').read() +counter = 0 +print '[', +for i in range(len(data)): + last = i == len(data)-1 + print ord(data[i]), + counter += 1 + if counter % 20 == 0: + print + if counter % 1005 == 0 and not last: + print '] + [', + elif not last: print ',', + +print ']' +''' + |