相关疑难解决方法(0)

在Python中,"SyntaxError:调用'print'时缺少括号"是什么意思?

当我尝试print在Python中使用语句时,它给了我这个错误:

>>> print "Hello, World!"
  File "<stdin>", line 1
    print "Hello, World!"
                        ^
SyntaxError: Missing parentheses in call to 'print'
Run Code Online (Sandbox Code Playgroud)

那是什么意思?

python python-3.x

378
推荐指数
7
解决办法
70万
查看次数

使用Python 3打印时出现语法错误

为什么在Python 3中打印字符串时会收到语法错误?

>>> print "hello World"
  File "<stdin>", line 1
    print "hello World"
                      ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

python python-3.x

260
推荐指数
3
解决办法
22万
查看次数

SyntaxError:print'string1中的语法无效:',string1

可能重复:
"print"附近的SyntaxError?

我是python的第一次用户.我刚刚在我的计算机上安装了Python 3.3,更新了PATH并尝试运行我刚刚复制的第一个python程序并将其从教程粘贴到新文件中.我收到的错误是:

File "C:\Users\bmahnke\Desktop\python.py", line 23
      print 'string1 is: ', string1

SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我不确定问题是什么,因为我是从教程网站得到的,我不确定,但差不多,他们不会在那里放一个不能编译的文件.所以我想知道我做错了什么

这是我正在使用的python代码:

#! C:\Python33\python.exe

string1 = 'In this class,'
string2 = 'I am learning to program in'
string3 = 'PYTHON.'

print 'string1 is: ', string1
print 'string2 is: ', string2
print 'string3 is: ', string3
print 'Put them altogether and you get:'
print string1, string2, string3
print string1 + string2 + string3
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏,谢谢.

python compiler-errors

0
推荐指数
1
解决办法
830
查看次数

标签 统计

python ×3

python-3.x ×2

compiler-errors ×1