Note that there are some explanatory texts on larger screens.

plurals
  1. POstring as bytes python3
    primarykey
    data
    text
    <p>let say i got string(that is supposed to be a bytes):</p> <pre><code>"b'YzJGNVltYzJGNVltOTBlbk5oZVdKdmRIcHpZWGxpYjNSNmMyRjVZbTkwZW5OaGVXSnZkSHB6WVhsaWIzUjZjMkY1WW05MGVnOTBlblJsYzNRPXNheWJvdHo='" </code></pre> <p>and i want to decode it but it say it got to be in bytes so i got to turn that to this somehow</p> <pre><code>b'YzJGNVltYzJGNVltOTBlbk5oZVdKdmRIcHpZWGxpYjNSNmMyRjVZbTkwZW5OaGVXSnZkSHB6WVhsaWIzUjZjMkY1WW05MGVnOTBlblJsYzNRPXNheWJvdHo=' </code></pre> <p>i am working on a chat client and when it sent the data(bytes), it turn into a string somehow when passing though the server and when it reach the other side, it can't decode it</p> <p>ps: it is ENCRYPT, decoding that will give random number and letters, the client will decrypt it</p> <p>oh, and, i don't really know if the '=' sign is supposed to be there, when i got the data in a test between me and my friend, i got it like that string(the one on the top) with the error saying that it got to be in byte.</p> <p>part of the code in the client(just one line to show everyone, the rest is a secret):</p> <pre><code>base64.b64decode(that_string).decode('ascii') </code></pre> <p>it mainly use ascii so i think this is right, right?</p> <p>more info:</p> <pre><code>base64.b64encode(message.encode('ascii')) </code></pre> <p>the message here is for getting the string sent from the other side</p> <pre><code>Room.message(str(secretEncrypt(par, codes()))) </code></pre> <p>i don't know how i miss this, it str it before it send =.= well, it still need to turn it to bytes, how so i do that?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload