问题是在Windows XP下运行Python脚本(模块)。
昨天我安装了适用于Windows的Python 3.3.0版本。 问题是我可以使用命令行和IDLE来计算(它的输出没有错误),但是如果我尝试简单的打印“你好”。 ,在命令提示符下输出,在GUI IDLE中显示:
Syntax error: invalid syntax路径变量设置为默认目录“C:\ Python33 \”,并且我可以再次使用它进行计算,但是从在线资源运行示例或者那些简单的东西对我来说是不可能的。
Problem is with running Python scripts(modules) under Windows XP.
Yesterday I installed Python 3.3.0 version for Windows. The problem is that I CAN use command line and IDLE to calculate (it works without errors in output), but if I try simple print "Hello." , output in command prompt, and in GUI IDLE shows me:
Syntax error: invalid syntaxPath variable is set to default directory "C:\Python33\", and again I can use it for calculation, but running examples from online resources or that simple stuff is currently for me impossible.
最满意答案
你需要在python 3.x中使用类似print("hello")东西
print已转换为python 3.x中的函数。
读到这个:` 打印是一个功能
Python 3.1.2 (release31-maint, Dec 9 2011, 20:50:50) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print 3 File "<stdin>", line 1 print 3 ^ SyntaxError: invalid syntax >>> print(3) # works fine 3you need to use something like print("hello") in python 3.x
print has been converted to a function in python 3.x.
read this :`Print is a function
Python 3.1.2 (release31-maint, Dec 9 2011, 20:50:50) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print 3 File "<stdin>", line 1 print 3 ^ SyntaxError: invalid syntax >>> print(3) # works fine 3更多推荐
发布评论