2016-10-28 73 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上 –

回答