Python 3
I want to send a binary string over a socket. I am using
socket.send(b"Hello from {0}",client_id)
however I find the it is not properly substitution clientid.
what am I doing wrong? I do I accomplish this in a binary string
Python 3
I want to send a binary string over a socket. I am using
socket.send(b"Hello from {0}",client_id)
however I find the it is not properly substitution clientid.
what am I doing wrong? I do I accomplish this in a binary string
Copyright © 2021 Jogjafile Inc.
{0}
is a placeholder for thestr.format
method, which you should be using, butbytes
objects do not have aformat
method; instead, you can format it as a string first and then convert it tobytes
with theencode
method: