在Windows XP下运行Python脚本(模块)(Running Python scripts(modules) under Windows XP)

编程入门 行业动态 更新时间:2024-10-14 04:28:21
在Windows XP下运行Python脚本(模块)(Running Python scripts(modules) under Windows XP)

问题是在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 syntax

Path 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 3

you 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

更多推荐

本文发布于:2023-07-15 07:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1111385.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   模块   Python   Windows   XP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!