Python 3.3套接字编程错误 [英] Python 3.3 socket programming error

查看:146
本文介绍了Python 3.3套接字编程错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python 3.3中,我在执行此行时遇到错误:

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

print ("Message from server : ") + msg

其中 msg (尝试做套接字编程,你可能猜到)

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

推荐答案

print()在Python 3中返回。所以,你试图连接(或添加)

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

尝试字符串格式化:

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

这篇关于Python 3.3套接字编程错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆