The way you are trying it, if I'm right, you are trying to use f
strings in an binary (b
) string, but it can't be done. So instead, try this,
comm = input('Input the system command: ') # mkdir test
sock.send(b'{}'.format(comm, encoding='utf-8'))
This will help you achieve what you wanna do.
if that doesn't work, you can do this,
comm = input('Input the system command: ') # mkdir test
sock.send(bytes(comm, encoding='utf-8'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…