Python 3.3.0中的语法打印无效

2024-05-20 09:32:18 发布

您现在位置:Python中文网/ 问答频道 /正文

Possible Duplicate:
Syntax error on print with Python 3

我试着在Python3中进行阶乘运算,不管我放了什么,它都告诉我同样的事情“无效语法:语法错误”……为什么它会给我一个错误?谢谢

版本是

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32

这就是我想做的

>>> def fact(n):
... res = 1
... while n > 1: 
... res *= n
... n -= 1
... return res

当我试图打印

>>> print fact(23)

它告诉我语法错误:无效语法


Tags: 版本on错误with语法reserror事情