mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-23 01:33:59 +08:00
bfc47f424a
Co-authored-by: SamNofee <sam@nofee.fun>
18 lines
343 B
Python
Executable File
18 lines
343 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
import textwrap
|
|
import re
|
|
|
|
with open(sys.argv[1], 'r') as file:
|
|
s = file.read()
|
|
|
|
b = bytearray()
|
|
|
|
if '--filter-character' in sys.argv:
|
|
s = re.sub(r'[^\x00-\xff]', '', s)
|
|
if '--null-terminate' in sys.argv:
|
|
s += '\x00'
|
|
|
|
b.extend(map(ord, s))
|
|
|
|
print(textwrap.fill(', '.join([hex(a) for a in b]), 96)) |