| |
- builtins.object
-
- HexaReader
class HexaReader(builtins.object) |
|
HexaReader(filename: str)
This class implement a hexadecimal reader for binary file.
>>> with open("test", 'wb') as f: f.write(b"\x00abc")
4
>>> hexareader = HexaReader("test")
>>> for line in hexareader.reader(): print(line)
00 61 62 63 .abc
>>> import os; os.remove("test") |
|
Methods defined here:
- __init__(self, filename: str)
- Initialize self. See help(type(self)) for accurate signature.
- get_line(self, data: bytes) -> str
- This function return hexareader line from bytes.
>>> hexareader = HexaReader(None)
>>> hexareader.get_line(b"\x00\x01")
'00 01 ..'
- reader(self) -> Generator[str, NoneType, NoneType]
- This function read file 16 chars by 16 chars and yield lines.
>>> with open("test", 'wb') as f: f.write(b"\x00abc")
4
>>> hexareader = HexaReader("test")
>>> for line in hexareader.reader(): print(line)
00 61 62 63 .abc
>>> import os; os.remove("test")
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |