Python语法错误 [英] Python Syntax Error

查看:160
本文介绍了Python语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上并且正在使用PyScripter.由于某种原因,所有内容都会导致语法错误,即使代码很明显也没有语法错误.例如,

I'm on Windows and I'm using PyScripter. For some reason everything results in a syntax error, even code that very obviously does not have a syntax error. For example,

print 6

会得到语法错误,

a = 6
print a

list = (1, 2, 7, 3)
print list

print 3 + 3

或我能想到的任何其他涉及打印的代码.我是否错误地下载了Python,我将其设置错误还是什么?

or any other code I can think of that involves printing. Did I download Python wrong, am I setting it up wrong, or what?

推荐答案

您是否正在使用Python 3? Python三中的print函数必须使用括号:

Are you using Python 3? The print function in Python three must use parentheses:

a = 6
print(a)

这篇关于Python语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆