Convert string to bytes object python

Python October 14, 2018 python

Convert string to bytes object python

python
my_simple_string = 'test'
bytes_obj = bytes(my_simple_string, 'utf-8')
print(bytes_obj)