|
发表于 2024-11-14 03:24:24
|
显示全部楼层
you need to convert file content in hw_ctree.xml to binary data as output.bin
3 s/ [4 o( Z' E1 ^/ R8 R2 f- d; f2 |
Python:! }/ ~: F- k. ?* j1 O
8 k' g3 J% w l- f3 } G
import struct$ T8 Q' `3 O8 W: Y" J7 I
) Q* Z! y! t' e! c$ u' G; ^
# to write in$ m* o3 T( f3 U9 |
data_to_write = "file content" #file content of hw_ctree.xml
0 j4 C. D# M4 k6 o$ k* V) J
: w4 N# [. A9 p) _# open .bin to write
* _( H9 f( w0 T- `1 B) m+ rwith open("output.bin", "wb") as bin_file:
$ s- k* c: v2 M# to binary
) x$ L8 s' [! F1 o5 P binary_data = data_to_write.encode('utf-8')3 C# V2 V2 Q4 a4 I |% f9 F" g
. n3 m& o& h* g# w" f1 e# F
# to .bin7 B, c, P f& C- P* P
bin_file.write(binary_data)
J* q, a- o5 l! U
% d( r, w, p! j' j8 E/ ^#So do game over |
|