file tool fixes
This commit is contained in:
Родитель
4cc863f413
Коммит
fe00c08a45
|
@ -22,5 +22,9 @@ while len(sdata) > 0:
|
|||
if len(sdata) > 0:
|
||||
lined += ['\n']
|
||||
json = '[' + ''.join(lined) + ']'
|
||||
print json
|
||||
|
||||
if len(sys.argv) < 3:
|
||||
print json
|
||||
else:
|
||||
print 'var ' + sys.argv[2] + '=' + json + ';'
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@ that and make a proper file out of it
|
|||
import os, sys, re
|
||||
|
||||
data = open(sys.argv[1], 'r').read()
|
||||
m = re.search('\[[\d, ]*\]', data)
|
||||
m = re.search('\[[\d, -]*\]', data)
|
||||
data = eval(m.group(0))
|
||||
data = [x&0xff for x in data]
|
||||
string = ''.join([chr(item) for item in data])
|
||||
out = open(sys.argv[1]+'.raw', 'wb')
|
||||
print data[0:80]
|
||||
|
|
Загрузка…
Ссылка в новой задаче