def read_file_in_hex(file_path):
try:
with open(file_path, 'rb') as file:
content = file.read()
hex_content = content.hex()
print(hex_content)
except FileNotFoundError:
print("Файл не найден.")
except Exception as e:
print(f"Произошла ошибка: {e}")
# Пример использования
file_path = 'путь к файлу'
read_file_in_hex(file_path)
try:
with open(file_path, 'rb') as file:
content = file.read()
hex_content = content.hex()
print(hex_content)
except FileNotFoundError:
print("Файл не найден.")
except Exception as e:
print(f"Произошла ошибка: {e}")
# Пример использования
file_path = 'путь к файлу'
read_file_in_hex(file_path)