python代码一个socket连接的问题

File "C:\Users\Hui\Desktop\py\aa.py", line 55, in <module>
main()
File "C:\Users\Hui\Desktop\py\aa.py", line 27, in main
s.connect((host, port))
File "E:\Python27\lib\socket.py", line 222, in meth
return getattr(self._sock,name)(*args)
TypeError: coercing to Unicode: need string or buffer, NoneType found

请在connect前加一行
print host, port
把这两个变量打印出来,看看对不对先
温馨提示:答案为网友推荐,仅供参考
相似回答