Introduction
- We can split data into two types: Binary and text.
- Binary:
- Binary data is interpreted as a sequence of bytes.
- The sequence conforms to a specific format. This could be anything from a single integer, to a complex file format.
- Binary data is usually displayed in hexadecimal form.
- Text:
- Text data is interpreted as a sequence of characters.
- The characters will belong to a specific character set, usually ANSI or Unicode.
- Text data can be further split into two types: printable characters and control characters.
- Printable Characters:
- These are characters that can be drawn to the screen, such as letters, numbers, and punctuation.
- Control Characters:
- Control characters perform an action, such as creating a new line.
Code (Python)
text = "Lorem ipsum dolor sit amet,"
print(text) # prints: Lorem ipsum dolor sit amet,
binary = bytes([0x12, 0x15, 0x15, 0x01])
print(binary) # prints: b'\x12\x15\x15\x01'