初学python,代码提示这种错误说是语法错误不懂啊求大神解释下

print "test: %s, the classifier came back with: %d, the real answer is: %d"\

^
SyntaxError: invalid syntax
这是版本信息

C:\Users\Administrator>python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:37:12) [MSC v.1600 3
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

你的是3.x版本,与2.x版不同的是,print已经变为funtion。

使用print需要加括号,不加括号要出错。


print("test: %s, the classifier came back with: %d, the real answer is: %d"\
        % ("test", 0, 1))

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-06-24
啊!看来你连最最基本的print("Hello World")打印输出都没注意么!
第2个回答  2015-05-31
估计是哪个逗号弄成中文输入的了
相似回答