20 lines
413 B
Python
20 lines
413 B
Python
#!/usr/bin/python3
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
class Utils:
|
|
def __init__(self, app):
|
|
self.app = app
|
|
|
|
self.home_path = str(Path.home())
|
|
|
|
def bstring_to_oz(self, data): # convert binary data to a string of ones and zeros (oz)
|
|
oz_bytes = []
|
|
|
|
for byte in data:
|
|
oz_bytes.append(format(byte, "08b"))
|
|
|
|
oz_string = " ".join(oz_bytes)
|
|
|
|
return oz_string
|