cardiograph-computer/python-microcontrollers/pi-pico/read-hex.py

21 lines
504 B
Python

# Open the binary file in read-binary mode
with open('test-multiply.bin', 'rb') as file:
# Read the entire file contents
binary_data = file.read()
# Convert the binary data to a string of hex bytes
hex_string = binary_data.hex()
# Print the hex string
print(hex_string)
# Open the binary file in read-binary mode
with open('test-multiply.bin', 'rb') as file:
# Read the entire file contents into a bytearray
byte_data = bytearray(file.read())
# Print the bytearray
print(byte_data)