Made it more readable.
This commit is contained in:
parent
64bb1fbf15
commit
fdaad3a1f5
1 changed files with 6 additions and 1 deletions
7
utils.py
7
utils.py
|
@ -12,6 +12,11 @@ class Utils:
|
|||
self.home_path = str(Path.home())
|
||||
|
||||
def bstring_to_oz(self, data): # convert binary data to a string of ones and zeros (oz)
|
||||
oz_string = " ".join([format(byte, "08b") for byte in data])
|
||||
oz_bytes = []
|
||||
|
||||
for byte in data:
|
||||
oz_bytes.append(format(byte, "08b"))
|
||||
|
||||
oz_string = " ".join(oz_bytes)
|
||||
|
||||
return oz_string
|
||||
|
|
Loading…
Reference in a new issue