【发布时间】:2017-11-21 01:38:00
【问题描述】:
我正在学习绑定和监听套接字,所以当我写完代码通过 cmd 连接到给定的本地主机时,它得到了以下错误。
s.listen(5)
conn, addr = s.accept()
print('connected with: ', + addr[0] + ':' + str(addr[1]))
我收到以下错误:
Traceback (most recent call last):
File "C:/Users/vineel/Desktop/Python34/PYTHON NETWORKING/bindsockets.py", line 19, in <module>
print('connected with: ', + addr[0] + ':' + str(addr[1]))
TypeError: bad operand type for unary +: 'str'
【问题讨论】: