我使用此代码计算我要打印的准确度分数
accuracy = metrics.accuracy_score(predictions,data[outcome])
print "Accuracy :%s" % "{0:.3%}".format(accuracy)
但是当我运行我的代码时,我得到以下错误。
File "<ipython-input-53-a86f8606658d>", line 19
print "Accuracy :%s" % "{0:.3%}".format(accuracy)
^
SyntaxError: invalid syntax
答案 0 :(得分:1)
试试这个:
print("Accuracy :{0:.3%}".format(accuracy))
演示:
accuracy = 0.83456789
print("Accuracy :{0:.3%}".format(accuracy))
打印:
Accuracy :83.457%