Python 3.3 socket programming error [closed]

非 Y 不嫁゛ 提交于 2019-12-14 03:37:59

问题


In Python 3.3 I am getting an error while executing this line:

print ("Message from server : ") + msg

where msg is received data from server (Trying to do socket programming as you might guess)


回答1:


print() returns None in Python 3. So, you're trying to concatenate(or add) None with msg, which results in an error.

Try string formatting:

print ("Message from server : {}".format(msg))


来源:https://stackoverflow.com/questions/18892619/python-3-3-socket-programming-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!