[python] add hex text file to binary file

This commit is contained in:
zhji 2024-04-19 18:08:43 +08:00
commit 91e3e5195d
3 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1 @@
<EFBFBD>リ[#<23>

View File

@ -0,0 +1 @@
FFD85B0423FFD9

View File

@ -0,0 +1,8 @@
file_path = "text.txt"
with open(file_path, "r") as file:
text_data = file.read()
binary_data = bytes.fromhex(text_data)
with open("text.bin", "wb") as file:
file.write(binary_data)