Onionr/onionr/onionrutils/bytesconverter.py

13 lines
236 B
Python
Raw Normal View History

def str_to_bytes(data):
try:
data = data.encode()
except AttributeError:
pass
return data
def bytes_to_str(data):
try:
data = data.decode()
except AttributeError:
pass
return data