问题
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