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.formatmethod, which you should be using, butbytesobjects do not have aformatmethod; instead, you can format it as a string first and then convert it tobyteswith theencodemethod: