2016-10-28 72 views
0

我正在研究Python Socking编程和我有一个send()函数的问题。 进出口以下这一点: https://pythontips.com/2013/08/06/python-socket-network-programming发送一条消息通过套接字在python

# send a thank you message to the client. 
    c.send('Thank you for connecting') 
    # Close the connection with the client 
    c.close() 

,但我会得到这个错误:

回溯(最近通话最后一个): 文件 “*。py” 为27行中 c.send( '谢谢你连接') TypeError:需要类似字节的对象,而不是'str'

+0

是你的Python 3? – dm03514

+0

是的我在python 3.5上 –

回答