In my Java code I have the following snippet :
String secret = "secret";
byte[] thebytes = secret.getBytes();
I would like to have exactly the same result in python. How can I do that ?
secret = 'secret'
thebytes = ??? ??? ???
Thanks.
EDIT:
In addition, it will be interesting to have the solution for Python 2.x and 3.x
secret.getBytes()?stris bytes. Thestrtype represents bytes. It contains bytes. How would you like to have the bytes, what do you want to do with them?